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

SS3: GridField for Images

Go to End

5 Posts   3787 Views


Community Member, 65 Posts

19 August 2012 at 9:16pm

I'd like to use GridField for adding an ImageGallery (similar to UncleCheese's ImageGallery Module but a lot easier). The only problem I have is, that I can only add images to the DataObjects (ImageResource) I use if I save every record once and add the image after that. But that's really dumb when adding more than 1 image at a time.
Here's the code I'm using:


Would it be possible to directly add multiple images to the relation as it was in SS2.4?
Thanks for your help.



Community Member, 87 Posts

21 August 2012 at 1:17am

Hi oleze,

i just made a very simple page gallery extension and i used two other modules for customizing gridfield: for reordering for bulk uploading images

hope that helps,


Christopher Darling

Community Member, 6 Posts

23 August 2012 at 12:10am

Edited: 23/08/2012 12:11am

You could always use an UploadField and enable multiple attachments. It does currently have a couple of downsides at the moment;
1. causing the CMS to load slower (see my post here;
2. no easy way of manually sorting, but you can sort by title or other field if the order they're uploaded isn't suitable

$uf = new UploadField('Name');
$uf->setConfig('allowedMaxFileNumber', 999);

// if you need to limit the extensions of files uploaded
$uf->allowedExtensions = array('jpg', 'gif', 'png');


Community Member, 65 Posts

23 August 2012 at 3:58am

@wmk: Thank you, that work's like a charme.
@Christopher: I think you misunderstood the question. The field wasn't the problem. But since I only want 1 Image on 1 ImageResource I think it wouldn't be the right solution to add a multiple UploadField to it (since there is no $has_many relation). The solution of wmk with bulk-uploading is exactly the thing I wanted to do.

Optic Blaze

Community Member, 190 Posts

16 October 2012 at 1:37am

Hi there,

I found a gallery module for ss3 that:
- allows for bulk uploading
- bulk editing
- drag and drop reordering

see their thread on the same topic: