From 124a2d37d3701f5e5aabc82bc7f521def5f98fdc Mon Sep 17 00:00:00 2001 From: krek0 Date: Thu, 7 May 2026 14:04:23 +0200 Subject: [PATCH] avoid uselsse exif() calls --- photologue/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/photologue/models.py b/photologue/models.py index 99b937c..e304b5c 100644 --- a/photologue/models.py +++ b/photologue/models.py @@ -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