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

Adding an Image to FileDataObjectManager


Reply


6 Posts   993 Views

Avatar
Garrett

Community Member, 245 Posts

14 October 2009 at 4:29am

Hi,

Is there some reason that I cannot add an Image file to a FileDataObjectManager? What if I have an object that requires BOTH a file AND an image?

I have my $has_one for the image, but when I click on "Attach Image," nothing happens and the ImageID is not added to the database. Why not?

Thanks,
Garrett

Avatar
UncleCheese

4085 Posts

14 October 2009 at 4:35am

No reason you can't do that. Post your code?

Avatar
Garrett

Community Member, 245 Posts

14 October 2009 at 8:43am

Hey there Uncle Cheese. Thanks for your reply. There was a mistake in my code :) While I have you here, though, I have another question for you-- how do you adjust the SIZE of images displayed inside the DataObjectManager inside the CMS? As you know, this can get very cantankerous!

Thanks,
Garrett

Avatar
UncleCheese

4085 Posts

14 October 2009 at 9:03am

I'm not sure what you mean. In the popup? Grid view? If you use ImageDOM, you get a slider that allows you to change the size of the images.

Avatar
Garrett

Community Member, 245 Posts

14 October 2009 at 10:08am

I mean the images displaying IN the actual DataObjectManager table IN the CMS. In List View. I don't know how to control the size of these images here. They show up ACTUAL size instead of trying to fit themselves into the table.

Avatar
UncleCheese

4085 Posts

14 October 2009 at 11:41am

Oh, wow. That's unusual that you're displaying the images in list view. Usually you use a custom getter for that.

In your headings array, you have something like:

array(
'Name' => 'Name of Thing',
'Description' => 'Description',
'DOMThumbnail' => 'Thumbnail of thing'
);

and in your dataobject:

function getDOMThumbnail()
{
return $this->MyImageField()->CroppedImage(50,50);
}

The headings array always looks for getXXX first, then falls back on the property itself.