Detect EXIF rotation metadata in image

When making a thumbnail, use the EXIF rotation data (if it exists) to
rotate the image before making the thumbnail.