Commit fd25633d authored by fuyunnan's avatar fuyunnan

提交裁剪图片重复下载图片的问题

parent d5979ef7
...@@ -176,9 +176,23 @@ class Drawer ...@@ -176,9 +176,23 @@ class Drawer
if ($imgInfo && end($imgInfo) == "image/webp") { if ($imgInfo && end($imgInfo) == "image/webp") {
$filename = trim(pathinfo($filePath, PATHINFO_FILENAME)); $filename = trim(pathinfo($filePath, PATHINFO_FILENAME));
$im = imagecreatefromwebp($filePath); // 加载 WebP 文件 $im = imagecreatefromwebp($filePath); // 加载 WebP 文件
imagejpeg($im, $savePath . $filename . '.jpeg', 100); // 以 100% 的质量转换成 jpeg 格式 switch ($ext){
case 'jpg':
$toNewFileName = $savePath . $filename . '.jpg';
break;
case 'png':
$toNewFileName = $savePath . $filename . '.png';
break;
case 'jpeg':
$toNewFileName = $savePath . $filename . '.jpeg';
break;
default:
$toNewFileName = $savePath . $filename . '.jpeg';
break;
}
imagejpeg($im, $toNewFileName, 30);//转化图片比例
imagedestroy($im); imagedestroy($im);
return $savePath . $filename . '.jpeg'; return $toNewFileName;
} }
return $savePath . "$filename.$ext"; return $savePath . "$filename.$ext";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment