'Since the iPhone will store an image on its side but with EXIF
data stating that it should be rotated, we need to find that
EXIF data and correctly rotate the image before storage.'

@classmethod
def adjust_image_orientation(cls, image):

    if hasattr(image, '_getexif'):
        exif = image._getexif()
        if exif:
            for (tag, value) in exif.items():
                decoded = TAGS.get(tag, tag)
                if (decoded == 'Orientation'):
                    if (value == 6):
                        image = image.rotate((-90))
                    if (value == 8):
                        image = image.rotate(90)
                    if (value == 3):
                        image = image.rotate(180)
                    break
    return image
