您好,欢迎访问一九零五行业门户网

手机safari图片上传竖变横处理

在手机safari上传图片时,竖着的照片会变成横着的照片,以下程序片段利用图片exif信息把图片旋转回去,代码抄自php.net官网。
http://php.net/manual/zh/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']) { case 8: $image = imagerotate($image,90,0); break; case 3: $image = imagerotate($image,180,0); break; case 6: $image = imagerotate($image,-90,0); break; }}//以下代码自行处理即可?>
其它类似信息

推荐信息