1

I'm uploading a photo to my website from my iPhone and saving it with some very simple code:

HttpPostedFile file = context.Request.Files[fileKey];
Image image = Image.FromStream(file.InputStream);
image.Save(myPath);

The image is the correct way up on my phone, however when it's uploaded to the website it's often on it's side or upside down. I assume this is because the iPhone is automatically rotating the image to compensate for the position the phone was in when it was taken.

I've seen this a couple of times including rotated images with Windows image preview but the most reproducible method is via a phone upload.

This is very frustrating for mobile users as they take a photo which is correctly orientated and it appears wrong when displayed on my site. Is it possible to extract this information from the uploaded image and rotate the image I save so it's orientated correctly?

Liath
  • 9,913
  • 9
  • 51
  • 81

0 Answers0