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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

No thumbnail - Attach from files pop up.

Go to End


James Bolitho

Community Member, 33 Posts

29 November 2012 at 4:37am

Edited: 05/12/2012 11:48pm


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 :-).