7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Adding an Image to FileDataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 870 Views |
-
Adding an Image to FileDataObjectManager

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 -
Re: Adding an Image to FileDataObjectManager

14 October 2009 at 4:35am
No reason you can't do that. Post your code?
-
Re: Adding an Image to FileDataObjectManager

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 -
Re: Adding an Image to FileDataObjectManager

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.
-
Re: Adding an Image to FileDataObjectManager

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.
-
Re: Adding an Image to FileDataObjectManager

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.
| 870 Views | ||
|
Page:
1
|
Go to Top |

