How can I easily resize an image after it has been uploaded in Django? I am using Django 1.0.2 and I've installed PIL.
I was thinking about overriding the save() method of the Model to resize it, but I don't really know how to start out and override it.
Can someone point me in the right direction? Thanks :-)
@Guðmundur H: This won't work because the django-stdimage package does not work on Windows :-(
I recommend using StdImageField from django-stdimage, it should handle all the dirty work for you. It's easy to use, you just specify the dimensions of the resized image in the field definition:
class MyModel(models.Model):
image = StdImageField(upload_to='path/to/img', size=(640, 480))
Check out the docs — it can do thumbnails also.