Jump to:

23478 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » UploadField thumbnails?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 454 Views
  • kylehudson00
    Community Member
    22 Posts

    UploadField thumbnails? Link to this post

    Hi All, as per this tutorial:


    I've included an image field in one of my custom page types. However, when one clicks "Attach a file" -> "From files", there are no thumbnails in the list view. Also, UploadField seems to automatically create an 'Upload' folder, which is not something that I want.

    So, my questions are:

    1) How can I show thumbnails when users are using UploadField to attach images that already exist in the assets folder
    2) How can I stop UploadField creating an "Uploads" folder? Further, can I set UploadField to default to a specific subfolder in assets?


  • socks
    Community Member
    190 Posts

    Re: UploadField thumbnails? Link to this post

    Think the Uploads folder always exists by default. See if setFolderName below helps.

    function getCMSFields() {
    $fields = parent::getCMSFields();

    // Image
    $imageField = new UploadField('TeamMemberImage','Team Member Image');
    $imageField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png'));
    $imageField->setConfig('allowedMaxFileNumber', 1);

    // Add
    $fields->addFieldToTab('Root.Images', $imageField);

    return $fields;

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.