Sasha wrote:
> Hello,
>
> I'd like to create a thumbnail for an image after it has been uploaded.
> I have seen two possible approaches descibed here - subclassing
> ImageField and overriding the save() method of the model. Although the
> former seems more elegant, the latter seems like less work and I'm
> inclined to try it first.
>
> However I'm not clear about how I can manipulate an ImageField (or any
> field for that matter) inside the models' save() method. Can anyone
> help?
>

 Are you wanting to replace the original image with a thumbnail, or do
you want to create another ImageField entry with the thumbnail? I'm
doing the second method.

 Perhaps all you need to know is that the ImageField can be saved using
yourmodel.save_yourfieldname_file(), which takes a filename and desired
file contents. Be aware that calling this will trigger a re-save of the
whole model and so you'll need to put some sort of conditional around
it to avoid a recursion.

 Damian Sinclair


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to