Iphone H5 upload photo is rotated

Source: Internet
Author: User

Recently done projects found under the iphone, we upload images will be flipped, and finally check the data found that it is really an issue with iOS

Do not say process, direct solution method

Under iOS, HTML uses <input type= "file" > upload image, the image will be rotated. JS is unable to solve this problem, HTML does not have the corresponding solution. Can only be placed in the background to handle, rotate the picture back again. iOS shot pictures provide exif information, orientation value is 6 clockwise 90 degrees, with this information we only need to rotate counterclockwise 90 degrees.

Pseudo code
The following is the pseudo code of PHP $exif = exif_read_data ($image _file);//Get EXIF information if (Isset ($exif [' Orientation ']) && $exif [' Orientation '] = = 6) {//Rotate imagerotate ($img, -90,0);}
Orientation Rotation angle 1:0°,6: Clockwise 90°, 8: Counterclockwise 90°,3:180°
Original address: Iphone H5 upload photo is rotated

Iphone H5 upload photo is rotated

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.