diff --git a/app/common/controller/Upload.php b/app/common/controller/Upload.php index ebe60c1..13cbdcc 100644 --- a/app/common/controller/Upload.php +++ b/app/common/controller/Upload.php @@ -100,7 +100,7 @@ class Upload extends BaseController $object='/'.ltrim($object,'/'); // 压缩图片 $compress_img = $file['compress_img'] ?? ''; - if ($filecate == 'image' && empty($compress_img) && $message) { + if ($filecate == 'image') { $compress_img = $this->getCompressImg($object, $info['ext'], $prefix); } $ret = [ @@ -433,9 +433,18 @@ class Upload extends BaseController { $newName2 = uniqid() . '.' . $ext; $compress_path = $prefix . $newName2; + $fullPath = root_path().'public/'; if($this->disk=='local'){ $compress_path='/storage/'.$compress_path; + $fullPath .= 'storage/'; } + + // 提前创建目录 + $fullPath .= $prefix; + if (!is_dir($fullPath)) { + mkdir($fullPath, 0755, true); + } + // 原图地址 $filePath = root_path().'public' . $src; // 处理图地址