图片压缩
This commit is contained in:
@@ -157,7 +157,7 @@ class UploadController
|
|||||||
->size(1024*1024*30)
|
->size(1024*1024*30)
|
||||||
->extYes(['image/jpeg','image/png'])
|
->extYes(['image/jpeg','image/png'])
|
||||||
->extNo(['image/gif'])
|
->extNo(['image/gif'])
|
||||||
->upload($file);
|
->upload($finalPath);
|
||||||
|
|
||||||
// 清理临时文件
|
// 清理临时文件
|
||||||
@unlink($tmpPath);
|
@unlink($tmpPath);
|
||||||
@@ -199,8 +199,8 @@ class UploadController
|
|||||||
$image->readImage($srcPath);
|
$image->readImage($srcPath);
|
||||||
|
|
||||||
// 防止超大图
|
// 防止超大图
|
||||||
$maxWidth = 2000;
|
$maxWidth = 1280;
|
||||||
$maxHeight = 2000;
|
$maxHeight = 1280;
|
||||||
|
|
||||||
$image->thumbnailImage($maxWidth, $maxHeight, true);
|
$image->thumbnailImage($maxWidth, $maxHeight, true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user