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.

Data Model Questions /

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

Adding an image to a DataObject from a file

Go to End

2 Posts   3097 Views


Community Member, 9 Posts

9 June 2010 at 6:45am


I have a DataObject, a DocumentObject, that contains many informations, but most importantly for my question : a File object (or more precisely a PDF object that restricts to pdfs and has a template) and an Image. I want the Image, a thumbnail actually, to be automatically generated from the document. I'm using imagemagick to do this.

For the moment, I'm generating the image and putting it in a predictable place and then find it... by knowing where it is. That's clearly not the proper way to do it, since I can't access SS gd functions or query any information from this image to use it dynamically in the template, etc.

I've been looking at the loadUploadedImage($tmpFile) function in Image... but haven't been sucessful in using it to join my generated image to the Image object (I'm guessing that's what it's for). For the moment, the image is generated in onBeforeWrite of the DataObject, I'm pretty that's where I must join it too.

So, do you have any experience in doing this or would you have any idea on the way to do it ?



Community Member, 9 Posts

11 June 2010 at 8:58am

You may want to check this : . Found by myself after all.