A recent project found in the Iphone, we uploaded pictures will be reversed, and finally access to information that is indeed the problem of IOS
Do not say that the process, the direct solution
Under iOS, html way to use <input type = "file"> upload pictures, pictures will be rotated. Js encountered this problem can not be solved, html there is no corresponding solutions. Only into the background to deal with, will rotate the picture and then rotate back. iOS provides a picture taken EXIF information, Orientation is 6 ie 90 degrees clockwise, with this information we just need to rotate counterclockwise 90 degrees.
Fake code
//下面是php的伪代码
$exif = exif_read_data($image_file);//获取exif信息
if (isset($exif['Orientation']) && $exif['Orientation'] == 6) {
//旋转imagerotate($img,-90,0);
}
Orientation rotation angle 1: 0 °, 6: clockwise 90 °, 8: counter-clockwise 90 °, 3: 180 °
Original Address: Iphone H5 upload photos to be rotated
Tags: H5 upload pictures flipped Iphone
Intelligent Recommendation
- php achieve two-dimensional code scanning Login
- A startup fallen 128 hours
- Mac command Collection
- PHP encryption and decryption methods
- [Demo] HTML5 upload pictures
Reproduced in: https: //my.oschina.net/54php/blog/599948