Fix AttributeError on EXIF load
This commit is contained in:
parent
167c9cb45b
commit
970db0dc05
1 changed files with 5 additions and 1 deletions
|
|
@ -290,6 +290,10 @@ class ImageModel(models.Model):
|
|||
setattr(self, name, result)
|
||||
return result
|
||||
else:
|
||||
# When this attribute error is raised, it's usually because
|
||||
# something tried to access a missing attribute on the photo.
|
||||
# 99% of the time is due to a typo in the attribute name we are
|
||||
# trying to access.
|
||||
raise AttributeError
|
||||
|
||||
def size_exists(self, photosize):
|
||||
|
|
@ -354,7 +358,7 @@ class ImageModel(models.Model):
|
|||
if 'Image Orientation' in self.exif() and \
|
||||
self.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]])
|
||||
IMAGE_EXIF_ORIENTATION_MAP[self.exif().get('Image Orientation').values[0]])
|
||||
# Resize/crop image
|
||||
if (im.size != photosize.size and photosize.size != (0, 0)) or recreate:
|
||||
im = self.resize_image(im, photosize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue