mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改图片处理
This commit is contained in:
parent
7ae13e77a7
commit
2c3c98457b
@ -17,7 +17,6 @@
|
||||
namespace app\admin\controller\api;
|
||||
|
||||
use think\admin\Controller;
|
||||
use think\admin\extend\ImageExtend;
|
||||
use think\admin\Storage;
|
||||
use think\admin\storage\AliossStorage;
|
||||
use think\admin\storage\LocalStorage;
|
||||
@ -138,9 +137,9 @@ class Upload extends Controller
|
||||
$file->move(dirname($distname), basename($distname));
|
||||
$info = $local->info($this->name, $this->safe, $original);
|
||||
if (in_array($extension, ['jpg', 'gif', 'png', 'bmp', 'jpeg', 'wbmp'])) {
|
||||
[$status, $message] = (new ImageExtend($distname))->compress($distname);
|
||||
if (empty($status) && $local->del($this->name)) {
|
||||
return json(['uploaded' => false, 'error' => ['message' => $message]]);
|
||||
[$width, $height] = getimagesize($distname);
|
||||
if ($width < 1 || $height < 1 && $local->del($this->name)) {
|
||||
return json(['uploaded' => false, 'error' => ['message' => '图片尺寸读取失败!']]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user