Hello, I've been trying to create a save method which resizes an image if it is too large. Using pil this is what I have so far:
class Photo(models.Model): title = models.CharField(max_length=750) photo = models.FileField(upload_to='full_size/') alt = models.CharField(max_length=50, null=True, blank=True) # Save the photo in less than or equal to 800x600 if image.size[0] > 800: if image.size[1] > 600: #resize image if its too large MAX_SIZE = (800,600) if self.photo: filename = self.photo.path image = Image.open(filename) image.thumbnail(MAX_SIZE, Image.ANTIALIAS) image.save(filename) super(Photo, self).save() else: super(Photo, self).save() but it doesn't seem to work. It doesn't produce any errors but the images are the same size that they where before. Could someone tell me what i'm doing wrong? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.