Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

How to set the correct path of an image in content field ?


Go to End


2 Posts   1726 Views

Avatar
Allisone

Community Member, 27 Posts

9 December 2008 at 11:17am

Edited: 09/12/2008 11:21am

Hello.
I have normal pages, which have content, in the content I sometimes have images.
Lets say the page can be called like this localhost/about/

Now I also have a virtual page, taking the content from that original page
This virtual page I can reach like this localhost/summary/about/

When I add a picture into my content I get this path generated: src="assets/Uploads/xyz.png"

The problem is. Even when loading the picture from this page localhost/about/ the assets/Uploads/xyz.png won't exist. Which could make me think I just have too write ../ before assets. But because of my additional virtual page, I'd still have a problem

I thouhgt maybe the mod_rewrite would take care of this problem but somehow it doesn't seem to do that :/

Does someone has a strategy ?

Avatar
Allisone

Community Member, 27 Posts

9 December 2008 at 11:48am

Finally I typed in the right search words, so that I could find another post in this forum dealing with the same problem.

You need to have <% base_tag %> in the head of your HTML template. See http://doc.silverstripe.com/doku.php?id=tutorial:1-building-a-basic-site#templates :)