From 2fb3eba233f99bce380f6f4bce0b8b9accf3ffda Mon Sep 17 00:00:00 2001 From: Wisp X <1591788658@qq.com> Date: Mon, 21 Mar 2022 09:36:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BB=A5=E5=8F=8A=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/ImageService.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Services/ImageService.php b/app/Services/ImageService.php index b243fcd4..a37ee57d 100644 --- a/app/Services/ImageService.php +++ b/app/Services/ImageService.php @@ -42,6 +42,7 @@ use Intervention\Image\Facades\Image as InterventionImage; use Intervention\Image\Imagick\Font; use Intervention\Image\ImageManager; use League\Flysystem\AwsS3V3\AwsS3V3Adapter; +use League\Flysystem\Config; use League\Flysystem\Filesystem; use League\Flysystem\FilesystemAdapter; use League\Flysystem\FilesystemException; @@ -166,7 +167,14 @@ class ImageService 'uploaded_ip' => $request->ip(), ]); - $filesystem = new Filesystem($this->getAdapter($strategy)); + $filesystem = new Filesystem( + adapter: $this->getAdapter($strategy), + config: [ + Config::OPTION_VISIBILITY => Visibility::PUBLIC, + Config::OPTION_DIRECTORY_VISIBILITY => Visibility::PUBLIC, + ] + ); + // 检测该策略是否存在该图片,有则只创建记录不保存文件 /** @var Image $existing */ $existing = Image::query()->when($image->strategy_id, function (Builder $builder, $id) {