diff --git a/app/admin/controller/v1/Images.php b/app/admin/controller/v1/Images.php index 3ba77905..f4c4116e 100644 --- a/app/admin/controller/v1/Images.php +++ b/app/admin/controller/v1/Images.php @@ -30,15 +30,15 @@ class Images return error($validate->getError()); } - $storage = config('filesystem.disks.public.url'); + $storage = config('filesystem.disks.image.url'); $filemd5 = $file->md5(); $filesha1 = $file->sha1(); $image_model = ImageModel::md5($filemd5)->find(); if (is_null($image_model)) { - $filename = Filesystem::disk('public')->putFile('images', $file); - // / 生成缩略图 + $filename = Filesystem::disk('image')->putFile($param['module'], $file); + // 生成缩略图 $image_manager = new ImageManager(new \Intervention\Image\Drivers\Gd\Driver()); $image = $image_manager->read('.' . $storage . '/' . $filename); $image->scale(200, 200); diff --git a/config/filesystem.php b/config/filesystem.php index 582a8f81..1c681a6e 100644 --- a/config/filesystem.php +++ b/config/filesystem.php @@ -19,6 +19,16 @@ return [ // 可见性 'visibility' => 'public', ], + 'image' => [ + // 磁盘类型 + 'type' => 'local', + // 磁盘路径 + 'root' => app()->getRootPath() . 'public/storage/images', + // 磁盘路径对应的外部URL路径 + 'url' => '/storage/images', + // 可见性 + 'visibility' => 'public', + ], // 更多的磁盘配置信息 ], ];