Auto-orient uploaded images based on EXIF data

Fixes #2338