avoid uselsse exif() calls
This commit is contained in:
parent
eb5d8696fa
commit
124a2d37d3
1 changed files with 4 additions and 3 deletions
|
|
@ -408,14 +408,15 @@ class ImageModel(models.Model):
|
|||
# Save the original format
|
||||
im_format = im.format
|
||||
# Rotate if found & necessary
|
||||
exif = self.exif()
|
||||
if (
|
||||
"Image Orientation" in self.exif()
|
||||
and self.exif().get("Image Orientation").values[0]
|
||||
"Image Orientation" in exif
|
||||
and exif.get("Image Orientation").values[0]
|
||||
in IMAGE_EXIF_ORIENTATION_MAP
|
||||
):
|
||||
im = im.transpose(
|
||||
IMAGE_EXIF_ORIENTATION_MAP[
|
||||
self.exif().get("Image Orientation").values[0]
|
||||
exif.get("Image Orientation").values[0]
|
||||
]
|
||||
)
|
||||
# Resize/crop image
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue