Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » Image functions

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

Page: 1
Go to End
Author Topic: 524 Views
  • ptvw
    Avatar
    Community Member
    10 Posts

    Image functions Link to this post

    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

  • ptvw
    Avatar
    Community Member
    10 Posts

    Re: Image functions Link to this post

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

  • ptvw
    Avatar
    Community Member
    10 Posts

    Re: Image functions Link to this post

    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!

    524 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.