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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

ModelAdmin, DOM and multiple uploads


Reply


3 Posts   564 Views

Avatar
EDi

Community Member, 5 Posts

18 November 2011 at 5:43am

Edited: 21/11/2011 11:17pm

Hello!

I'm new to SilverStripe and have a problem I can't solve. I hope you can help me. :)

I have a Gallery object (DataObject with Title and Author fields) with has_many relation to MyImage (Image object extended with Title and Caption fields). I'm using ModelAdmin to edit Galleries. After creating Gallery I have to add lots of MyImages to it. (I'm using Uploadify for the files.) The problem is SS asks me to enter Title and Caption for image, save the record and then add a single file at once.

When there is a GalleryPage without adding images to Gallery object, Uploadify gives me the tool to upload as many images at once, as I need with no need to fill titles and captions (in some galleries I need them, but in biger ones I don't). Is it possible to get the same functionality in my Gallery form? And if not, maybe you can point me in the right direction to solve this task?

I need to add every image to Gallery object. I need to upload tons of images. Sometimes I have to fill the Title and Caption for the image.

Cheers!
ED

Avatar
danzzz

Community Member, 175 Posts

21 November 2011 at 10:53pm

Edited: 21/11/2011 11:17pm

hi

do you also have a relation in the MyImage class to? sampel of mine:

class MyImage extends Image {

static $has_one = array (
   'Produkt' => 'Produkt',
);

}

parts of my Produkt.php

class Produkt extends Page {
...

static $has_many = array(
   'Produktbilder' => 'MyImage'
);

...

function getCMSFields() {

...

$images = new MultipleImageUploadField('Produktbilder', 'Produktbilder');
$images->removeFolderSelection();
$images->imagesOnly();
$images->uploadFolder = 'Uploads/Produktbilder';

this is working for me and I can add multiple images at once ...

best,

Avatar
EDi

Community Member, 5 Posts

21 November 2011 at 11:12pm

Edited: 21/11/2011 11:17pm

Yes, I have the relations. It is working with the Page object, but with DataObject does not.