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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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 gallery - upload all images at once


Go to End


10 Posts   4711 Views

Avatar
JonShutt

Community Member, 244 Posts

19 September 2012 at 4:23pm

Hi,

I've been building a few sites with SS3 recently and it's all going fine, apart from one thing.

a page which 'has many' images...
-------

public static $has_many = array(
'HolidayHomeImages' => 'HolidayHomeImage'
);

--------

class HolidayHomeImage extends DataObject {

public static $has_one = array(
'Image' => 'Image',
'HolidayHomePage' => 'HolidayHomePage'
);
}

I have to create create 'dataobject' separately, clicking 'add', then saving, then attaching image...
needles to say it's time consuming compared to selecting a whole load of images and uploading all together.

I notice in the assets area it's possible, so there must be a way of doing it on my pages too?

Also, when i'm on the page to edit the dataobject details, I get a dropdown to choose the 'HolidayHomePage' eg the has_many relationship. It gets set automatically, but users get confused why it's there. Is there any way to hide it?

Cheers

Avatar
Stef87

Community Member, 66 Posts

19 September 2012 at 8:39pm

Hi Futureweb

Have you looked at imagedataobjectmanager? http://ss2doc-v2.ernie.silverstripe.com/old/modules:dataobjectmanager

It has a multiple upload feature and will work with your relationship.

On the other issue, do you want to hide the field completely from the page? You can simply remove the field like so.

$fields->removeFieldFromTab("Root.Content.Main","HolidayHomepageDropdown");

Avatar
JonShutt

Community Member, 244 Posts

19 September 2012 at 10:16pm

Hi, the imagedataobject manager doesn't work in SS3 as far as I know... However, that is exactly the result I want to get working ins SS3

I see the same questions is being posed here.. http://www.silverstripe.org/dataobjectmanager-module-forum/show/20867

i removed the dropdown from the dataobject edit page with the following with the dataobject php file...

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Main","HolidayHomePageID");
return $fields;

}

Avatar
Stef87

Community Member, 66 Posts

19 September 2012 at 10:24pm

Edited: 19/09/2012 10:28pm

Oh right. I'm still using 2.4.7 as another module I wanted to use didn't work with SS3. I haven't used SS3 at all so I can't say with confidence what will or won't work. However, from reading the docs it looks like uploadField has a multiple upload option.
http://api.silverstripe.org/3.0/framework/forms/UploadField.html

If this isn't what you want you can always ask Uncle Cheese in the DOM forum since he's the creator of ImageDataobjectManager.

Did that code work for the field then? Or is the problem something else entirely?

Avatar
hallecsyz

Community Member, 5 Posts

26 September 2012 at 1:48am

Hi Futureweb,

I was looking for a bulk image uploader, too. I asked around the forum but I didn't get any answers, but in StackOverflow someone recommended me to update SilverStripe to 3.0.2 and try with the GridFieldEditingTools module.

Here's my question in SO: http://stackoverflow.com/questions/12356179/uploading-multiple-images-in-silverstripe-3-0

And here's the link to the module: https://github.com/colymba/GridFieldBulkEditingTools

I didn't try it yet, I'm working on it, please tell me if you try it and works!

Avatar
wmk

Community Member, 87 Posts

29 September 2012 at 11:36pm

Hi,

the GridFieldBulkEditingTools work fine. Used it in combination with SortableGriedField for a simple image gallery extension.

Just try them out, it's fun ;)

Avatar
JonShutt

Community Member, 244 Posts

15 October 2012 at 10:42am

Great - got those working perfectly!

further to that, i wrote a wee article about it
http://www.silverstriperesources.com/articles/how-to-make-a-photo-gallery-in-silverstripe-3/

and packaged up the files as a plugin module
http://www.silverstriperesources.com/modules/silvestripe-3-gallery-plugin-module/

thanks to the people who made those two modules it was pretty quick to get a gallery working just as I wanted it!

Avatar
DigitalDesign

Community Member, 1 Post

11 August 2013 at 10:54am

I'm looking for exactly this.... Wondering if by chance you have a current link for this article or file? The old one seems to be dead.

Go to Top