Unverified Commit f7f9a217 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Remove unnecessary cast (already str)

This also adds a comment wrt upscaling small images. See
https://github.com/python-pillow/Pillow/blob/bc354d10c2610be10ca27c63fac97b62cd26ee3b/PIL/Image.py#L1800
parent 2bb3f98e
......@@ -40,8 +40,9 @@ class Photo(models.Model):
super(Photo, self).save(*args, **kwargs)
if self._orig_file != self.file.path:
image_path = str(self.file.path)
image_path = self.file.path
image = Image.open(image_path)
# Image.thumbnail does not upscale an image that is smaller
image.thumbnail(settings.PHOTO_UPLOAD_SIZE, Image.ANTIALIAS)
image.save(image_path, "JPEG")
self._orig_file = self.file.path
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment