Hi,
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');
$thumbField->setFolderName('Uploads/gallery-images');
....
I hope that explanation makes sense. Any ideas would be appreciated.
Thanks,
James
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');
$columns->setDisplayFields(array(
'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 :-).
Cheers,
James