From 807d2dce0156b3b68293284094a5d3aa2f778ebc Mon Sep 17 00:00:00 2001 From: lq Date: Tue, 17 Jun 2025 15:06:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=E9=A6=96=E9=A1=B5=E5=92=8C?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/ImageService.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; }