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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Bug Reports


Go to End


297 Posts   102003 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 October 2009 at 1:21am

Have you confirmed that mod_security is not running?

Avatar
dospuntocero

Community Member, 54 Posts

14 October 2009 at 1:49pm

Edited: 14/10/2009 2:01pm

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

Community Member, 215 Posts

14 October 2009 at 1:52pm

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

Thanks

Avatar
UncleCheese

Forum Moderator, 4102 Posts

14 October 2009 at 3:34pm

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

Community Member, 54 Posts

14 October 2009 at 3:51pm

Edited: 14/10/2009 3:53pm

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

Forum Moderator, 4102 Posts

14 October 2009 at 4:19pm

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

Community Member, 54 Posts

14 October 2009 at 4:24pm

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

Community Member, 48 Posts

15 October 2009 at 3:26pm

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.

Go to Top