Recently made mobile Web project but encountered on the Apple device HTML upload pictures, the picture to the background is rotated rotation angle is different, so again
When reading photos, can not display properly, has now found a solution, as for the reasons for not quite understand the translation is also completely according to the word translation of different words.
But share the method. The reason is that Apple stole a lazy and did not deal with the photos after the shooting, while Android was processed.
The reason for the rotation is affected by the angle of the Apple device, and here's the workaround. PHP on the environment other languages to make the corresponding adjustment can be. Same principle
http://php.net/manual/en/function.exif-read-data.php
<?php
$image=Imagecreatefromstring(File_get_contents($_files[' Image_upload '][' Tmp_name ']));
$exif=Exif_read_data($_files[' Image_upload '][' Tmp_name ']);
if (!empty ($exif[' Orientation '])) {
Switch$exif[' Orientation ']) {
Case8:
$image=Imagerotate($image,90,0);
Break
Case3:
$image=Imagerotate ( $image ,180 ,0 break;
Case 6:
$image = Imagerotate ( $image ,-90 ,0 break;
}
}
//$image now contains a resource with the image oriented correctly
?>
Image rotation problem after uploading apple HTML