Jump to:

23456 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » No thumbnail - Attach from files pop up.

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: 418 Views
  • James Bolitho
    Community Member
    33 Posts

    No thumbnail - Attach from files pop up. Link to this post


    I am just wondering if I am missing something but I have noticed that when using the 'UploadField' in SS 3.0.3 to attach image files to a DataObject if I select 'Attach a file' - 'from files', in the resulting pop up that displays all the files available to be selected there is no thumbnail displayed next to the name of the file unlike under the files tab.

    I am not sure if I am being dumb and missing a step when constructing my object but below is a snippet from my Object relating to the upload field:

    $fields = new FieldList();
    $fields->push($thumbField = new UploadField('GalleryImage', 'Gallery Image'));
    $thumbField->allowedExtensions = array('jpg', 'png', 'gif');

    I hope that explanation makes sense. Any ideas would be appreciated.



    Edit - solution found

    Ok after some looking around the core files I found a solution. I edited the UploadField.php file in framework/forms folder. Added the following lines after line 975:

    $columns = $fileField->getConfig()->getComponentByType('GridFieldDataColumns');
    'StripThumbnail' => '',
    'Name' => 'Name',
    'Title' => 'Title'

    Not keen on using core hacks but this at least gets a thumbnail of an image displaying (well it has for me anyway). If anyone has a better solution I am all ears .



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.