Resize uploaded file file with PIL
Hi,
I want to resize the uploaded file before saving a form. I'd like to
do something like
img = request.FILES['image']
img.thumbnail( (200,200), Image.ANTIALIAS)
img.save(request.FILES['image'], "JPG")
photo_form = forms.PhotoEditForm(request.POST, request.FILES,
instance=photo)
photo_form.save()
i.e. I'd like to put it into the form resized, and preferably without
a temporary file.
What I don't know is what FILES object really is so it's hard to
figure out what's the right way to achieve this.
Any ideas?
Thanks,
Igor
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home