1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Merge pull request #1356 from haiwen/get-exif

update get image exif info
This commit is contained in:
Daniel Pan
2016-09-17 15:43:50 +08:00
committed by GitHub

View File

@@ -26,13 +26,12 @@ def get_share_link_thumbnail_src(token, size, path):
def get_rotated_image(image): def get_rotated_image(image):
# get image's exif info # get image's exif info
exif = {}
try: try:
exif = image._getexif() exif = image._getexif() if image._getexif() else {}
except Exception: except Exception:
return image return image
orientation = exif.get(0x0112) orientation = exif.get(0x0112) if isinstance(exif, dict) else 1
# rotate image according to Orientation info # rotate image according to Orientation info
if orientation == 2: if orientation == 2:
# Vertical image # Vertical image