Iphone H5 upload photos to be rotated


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

Reproduced in: https: //my.oschina.net/54php/blog/599948

Guess you like

Origin blog.csdn.net/weixin_34038293/article/details/91518303