美文网首页
php识别翻转iphone拍摄的颠倒图片

php识别翻转iphone拍摄的颠倒图片

作者: 玛瑙鑫 | 来源:发表于2019-12-25 18:52 被阅读0次
public function save() {

$file = $_FILES['file'];

dump_log(原始凭证:', $file);

$exif = exif_read_data($file['tmp_name']);

//原图

$dst_image = imagecreatefromstring(file_get_contents($file['tmp_name']));

if (!empty($exif['Orientation'])) {

            switch ($exif['Orientation']) {

                case 8:

                    $dst_image = imagerotate($dst_image, 90, 0);

                    break;

                case 3:

                    $dst_image = imagerotate($dst_image, 180, 0);

                    break;

                case 6:

                    $dst_image = imagerotate($dst_image, -90, 0);

                    break;

            }

        }

//保存到本地

 imagejpeg($dst_image ,'../storage/tmp.jpeg');



 //释放内存

 imagedestroy($dst_image );

}

相关文章

网友评论

      本文标题:php识别翻转iphone拍摄的颠倒图片

      本文链接:https://www.haomeiwen.com/subject/uvfhoctx.html