diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 197b2f8b..7280611f 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -14,7 +14,6 @@ class ImageController extends Controller $image = request()->file('image'); $pid = request()->file('pid'); - dd($image); return new ImageService()->processImage($image, $pid); } } diff --git a/app/Service/ImageService.php b/app/Service/ImageService.php index c45a96a9..51188a3b 100644 --- a/app/Service/ImageService.php +++ b/app/Service/ImageService.php @@ -17,9 +17,8 @@ class ImageService */ public function processImage($imageFile, $pid = 1) { - return $imageFile; // 1. 保存原始图片 - $originalPath = $this->storeOriginalImage(file_get_contents($imageFile)); + $originalPath = $this->storeOriginalImage($imageFile); // 2. 无损压缩图片 $compressedPath = $this->compressToWebp($originalPath); @@ -48,7 +47,7 @@ class ImageService protected function storeOriginalImage($imageFile) { $path = 'images/original/cc_'. date('Ymdhis') . Str::random(40) . '.' . $imageFile->getClientOriginalExtension(); - Storage::put($path, $imageFile); + Storage::put($path, file_get_contents($imageFile)); return $path; }