我正在编写一个简单的php上传脚本。很好用。但由于某种原因,当图像被压缩时,它们会旋转。有时它们完全旋转180度,有时90度。它为什么要这样做?我该怎么阻止它?这是我的密码:
$name = ''; $type = ''; $size = ''; $error = '';
function compress_image($source_url, $destination_url, $quality) {
$info = getimagesize($source_url);
if ($info['mime'] == 'image/jpeg')
$image = imagecreatefromjpeg($source_url);
elseif ($info['mime'] == 'image/gif')
$image = imagecreatefromgif($source_url);
elseif ($info['mime'] == 'image/png')
$image = imagecreatefrompng($source_url);
imagejpeg($image, $destination_url, $quality);
//echo "result ".$destination_url;
//correctImageOrientation($destination_url);
return $destination_url;
}
$url = 'test/compressed.jpg';
compress_image($_FILES["file"]["tmp_name"], $url, 30);
暂无答案!
目前还没有任何答案,快来回答吧!