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

IDOM + uploadify: can't add existing files


Reply


2 Posts   469 Views

Avatar
max5k

Community Member, 8 Posts

2 March 2012 at 1:42am

Edited: 02/03/2012 1:51am

Hello everyone,

i have a Pagetype "SlideshowPage" where multiple Images should be added.

Therefor i have a Class "SlideshowImage extends Image"
which has_one "SlideshowPage"
SlideshowPage $has_many "SlideshowImages" => "SlideshowImage".

On the Page i have a IDOM:

$manager = new ImageDataObjectManager($this, 'SlideshowImages', 'SlideshowImage');
$fields->addFieldToTab('Root.Content.Main', $manager, 'Content');

Everything is working beautifully so far.
As long as i upload images directly from the SlideshowPage.

Now the Problem:

It seems to be impossible to add images previously uploaded via the Assetadmin.
(can see, them select them, continue but images are not attached. no ajax reponse erros, though)

Seems to me that this is because previously uploaded images have the ClassName "Image"
and Images uploaded via the IDOM are generated as "SlideshowImages"

Because when i change the className (of images added via AssetAdmin) manually in the "File" table, ("Image" to "SlideshowImage")
i can actually add them on the SlideshowPage via IDOM.

Is there any way to configure IDOM to add existing "Images" as "SlideshowImages" ?

Any help would be much appreciated!

cheers

Max

Avatar
max5k

Community Member, 8 Posts

2 March 2012 at 7:05am

well...

here's the (kind of obvious) solution:

my custom image:

Class SlideshowImage extends DataObject{
$has_one = atrray( 'Image', 'Image');
}

my page holding the custom images

new ImageDataObjectManager($this, 'Images', 'LdGalleryImage', 'Image')

i think it's a bit tricky to understand not to extend Image directly (as Images extends File which extends DataObject)

but it's all already explained here: http://www.silverstripe.org/dataobjectmanager-module-forum/show/14593

so thanks :) !