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 );
}
网友评论