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