3064 Posts in 865 Topics by 647 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1650 Views |
-
Adding an image to a DataObject from a file

9 June 2010 at 6:45am
Hi,
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 ?
Thanks.
-
Re: Adding an image to a DataObject from a file

11 June 2010 at 8:58am
You may want to check this : http://silverstripe.org/data-model-questions/show/286020 . Found by myself after all.
| 1650 Views | ||
|
Page:
1
|
Go to Top |

