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.

Template Questions /

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

Image functions


Go to End


3 Posts   1217 Views

Avatar
ptvw

Community Member, 10 Posts

18 July 2011 at 10:05pm

Hello -

I have set a custom field called $bgImage in the CMS. This field simply takes an image (img src="path/to/image").

it works fine in the front end when outputted simply as $bgImage, but I am unable to see any output when trying to use functions such as $bgImage.URL in my templates.

My PHP server has GD2. I am using WAMP so cannot set permissions for my tmp folder. Does anyone have any ideas of what im doing wrong?

Thanks

PTVW

Avatar
ptvw

Community Member, 10 Posts

18 July 2011 at 11:03pm

added a silverstripe-cache folder which is working but still no joy

Avatar
ptvw

Community Member, 10 Posts

19 July 2011 at 4:03am

OK i solved it.

Im very new to SilverStripe and made some simple mistakes.

In order to user methods such as .URL etc with images you have to declare a new database table first using either $has_one or $has_many. Then add a tab. Then you will have a new tab where you can upload images in your CMS and use them at will. I guess I will need to use an enumerated type for more than one image.

Im using this to allow people to update background images in the CMS so I can have text overlayed over an image rather than static pictures!