diff --git a/app/Service/ImageService.php b/app/Service/ImageService.php index 67e33fd4..691a6cdf 100644 --- a/app/Service/ImageService.php +++ b/app/Service/ImageService.php @@ -18,7 +18,7 @@ class ImageService public function processImage($imageFile, $pid = 1) { // 1. 保存原始图片 - $originalPath = $this->storeOriginalImage($imageFile); + $originalPath = $this->storeOriginalImage(file_get_contents($imageFile)); // 2. 无损压缩图片 $compressedPath = $this->compressToWebp($originalPath); @@ -46,9 +46,8 @@ class ImageService */ protected function storeOriginalImage($imageFile) { - $path = 'images/original/' . Str::random(40) . '.' . $imageFile->getClientOriginalExtension(); - dd([$imageFile, $path]); - Storage::put($path, file_get_contents($imageFile)); + $path = 'images/original/cc_'. date('Ymdhis') . Str::random(40) . '.' . $imageFile->getClientOriginalExtension(); + Storage::put($path, $imageFile); return $path; }