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

Bug Reports


Reply

297 Posts   49748 Views

Avatar
UncleCheese

14 October 2009 at 1:21am 4085 Posts

Have you confirmed that mod_security is not running?

Avatar
dospuntocero

14 October 2009 at 1:49pm (Last edited: 14 October 2009 2:01pm), Community Member, 54 Posts

Hi Uncle, i have a weird problem with ImageDataObjectManager, i cant import images from folders:

this is my code...

      $Ads = new ImageDataObjectManager(
       $this,
       'InteractionBanners',
       'InteractionBanner',
         'InteractionBtn',
       array(
            'LinkText' => 'LinkText',
            'Link' => 'Link'
       ),
       'getCMSFields_forPopup'
      );
      
      $Ads->setPageSize(100);
      $f->addFieldToTab( 'Root.Content.InteractionBanners', $Ads );

i dont understand what is missing, but if i upload a new file this file all works ok.

Avatar
Howard

14 October 2009 at 1:52pm Community Member, 215 Posts

Yea you were right it was just a mod_security problem - I shoulda thought about that!

Thanks

Avatar
UncleCheese

14 October 2009 at 3:34pm 4085 Posts

File types that are not in the allowedFileTypes array will get greyed out. In ImageDOM, I believe that defaults to gif, jpg, and png. You can always set it manually with setAllowedFileTypes().

Avatar
dospuntocero

14 October 2009 at 3:51pm (Last edited: 14 October 2009 3:53pm), Community Member, 54 Posts

thanks for the quick response :)

i have tried this:

      $Ads = new ImageDataObjectManager(
       $this,
       'InteractionBanners',
       'InteractionBanner',
         'InteractionBtn',
       array(
            'LinkText' => 'LinkText',
            'Link' => 'Link'
       ),
       'getCMSFields_forPopup'
      );
      $Ads->setAllowedFileTypes(array('jpg','png','gif'));

but i think thats not the way it works.. can you provide an example?

when i have added that i get a blank screen with the following error:

ImageDataObjectManager::setAllowedFileTypes() -- Only files of type jpg, jpeg are allowed.

Avatar
UncleCheese

14 October 2009 at 4:19pm 4085 Posts

Yeah, that's right. I excluded png because at the time Silverstripe couldn't resample PNG in its GD class. I'll update the code to allow PNG. For now, just add it to the $limitFileTypes array in ImageDOM.

Avatar
dospuntocero

14 October 2009 at 4:24pm Community Member, 54 Posts

thanks! :)
by the way, it seems that silverstripe now can resample pngs correctly.. i have modified your class some moments ago and with pngs works, but not with transparent gifs (transparency renders black) and both are correctly resized

Avatar
keeny

15 October 2009 at 3:26pm Community Member, 48 Posts

Hi all,

I'm having an issue where if I upload an image in 'Files & Images' to a subfolder, the files go straight into the root of the assets folder and not into the folder I want them to.

Any ideas?

Cheers,

Barry.