Incorrect orientation when image captured by HTML5 api file on iOS 6.0

I am using an HTML5 api file in a mobile web application to upload images. I capture the image using the camera and upload it to the server.
The problem is that if I capture a portrait image, the downloaded image is automatically converted to landscape.

+6
source share
1 answer

You will need to convert the image to correct the orientation. Fortunately, the image should include EXIF ​​data that you can use to do this. If you like, you can do this before the image is uploaded to your server:

  • Read EXIF ​​image
  • Use the canvas element to transform the image depending on the situation.
  • Export canvas image to image file

There is an excellent entry, including code samples, in this blog post.

+1
source

Source: https://habr.com/ru/post/944112/


All Articles