refactor: 修改图片上传
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -19,6 +19,16 @@ return [
|
||||
// 可见性
|
||||
'visibility' => 'public',
|
||||
],
|
||||
'image' => [
|
||||
// 磁盘类型
|
||||
'type' => 'local',
|
||||
// 磁盘路径
|
||||
'root' => app()->getRootPath() . 'public/storage/images',
|
||||
// 磁盘路径对应的外部URL路径
|
||||
'url' => '/storage/images',
|
||||
// 可见性
|
||||
'visibility' => 'public',
|
||||
],
|
||||
// 更多的磁盘配置信息
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user