jonasundderwolf/django-image-cropping — pull request #25 by shibz (2013-05-01 22:08:32+00:00)
Title: Fix for images with "orientation" exif tag

The easy-thumbnails app supports the "orientation" EXIF tag by default and will automatically rotate images. This causes issues with jCrop on images that are EXIF-tagged to be rotated by 90 degrees because jCrop uses the un-rotated width/height values taken from the Django ImageField. Those pre-rotation width/height values are then overlaid on top of the post-rotation easy-thumbnails image. As a result, any images where the EXIF data specifies a 90 degree rotation do not crop properly unless the image is perfectly square.

This patch solves this issue by checking the EXIF data and swapping the width/height for images with a 90 degree rotation.

I used [this easy-thumbnails code](https://github.com/SmileyChris/easy-thumbnails/blob/master/easy_thumbnails/utils.py#L118) as a reference for making this patch.