From 4e38a5397118f3b334e339165d9f3faec17d8bed Mon Sep 17 00:00:00 2001 From: Wisp X Date: Wed, 19 Jan 2022 13:37:34 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E5=8A=A8=E5=9B=BE?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=90=8E=E6=B2=A1=E6=9C=89=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/ImageService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Service/ImageService.php b/app/Service/ImageService.php index 8e4c0b46..57268d01 100644 --- a/app/Service/ImageService.php +++ b/app/Service/ImageService.php @@ -160,13 +160,13 @@ class ImageService $builder->where('strategy_id', $id); })->where('md5', $image->md5)->where('sha1', $image->sha1)->first(); if (is_null($existing)) { - $handle = $img->stream(); + $handle = fopen($file, 'r'); try { - $filesystem->writeStream($pathname, $handle->detach()); + $filesystem->writeStream($pathname, $handle); } catch (FilesystemException $e) { throw new UploadException('图片上传失败'); } - $handle->close(); + @fclose($handle); } else { $image->fill($existing->only('path', 'name')); }