Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Adding image upload to cms

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

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

Page: 1
Go to End
Author Topic: 1013 Views
  • StuM
    Avatar
    Community Member
    56 Posts

    Adding image upload to cms Link to this post

    Hi All,

    I tried the following tutorial:

    http://doc.silverstripe.com/doku.php?id=imageupload

    but it doesn't seem to work, no images are uploaded.

    The indexes are created and present in the table for the page type, and images can be uploaded via Files/Uploads, so that works as well.

    my code:

    ...
    static $has_one = array(
          'LeftAd' => 'Image',
          'LeftBottomAd' => 'Image'
       );

    ...

    public function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab('Root.Content.LeftAdvertisement', new SimpleImageField('LeftAd', 'Left Top Ad'));
          ...
          $fields->addFieldToTab('Root.Content.LeftAdvertisement', new SimpleImageField('LeftBottomAd', 'Left Bottom Ad'));
          ...
          return $fields;
       }

    any clues???

    I'm using daily build version from Monday 1st September

  • StuM
    Avatar
    Community Member
    56 Posts

    Re: Adding image upload to cms Link to this post

    OK, just changed the SimpleImageField to an ImageField and it works, so all good now

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: Adding image upload to cms Link to this post

    Ive updated the doc. Should use an ImageField anyway. SimpleImage fields are normally for front end eg sign up forms.

    1013 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.