avoid uselsse exif() calls

This commit is contained in:
krek0 2026-05-07 14:04:23 +02:00
parent eb5d8696fa
commit 124a2d37d3

View file

@ -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