Php “显示此错误”;未定义索引:缩略图“;在laravel中添加文件系统时
当我在Php “显示此错误”;未定义索引:缩略图“;在laravel中添加文件系统时,php,laravel,storage,Php,Laravel,Storage,当我在filesystems.php的文件系统磁盘中添加新的公共目录时,如下所示 'thumbnail' => [ 'driver' => 'local', 'root' => storage_path('app/public/relativeContentPath/thumbnail'), 'url' => env('APP_URL').'/storage', 'visibility' => 'thu
filesystems.php
的文件系统磁盘中添加新的公共目录时,如下所示
'thumbnail' => [
'driver' => 'local',
'root' => storage_path('app/public/relativeContentPath/thumbnail'),
'url' => env('APP_URL').'/storage',
'visibility' => 'thumbnail',
'permissions' => [
'file' => [
'public' => 0664,
'private' => 0600,
],
'dir' => [
'public' => 0775,
'private' => 0700,
],
],
],
$fileNameToStore = md5(time()).'.jpg';
$photoThumbnail = ImageResize::make($productContent)
->resize(80, 80, function ($constraint) { $constraint->aspectRatio(); } )
->encode('jpg',80);
Storage::disk('thumbnail')->put( $fileNameToStore, $photoThumbnail);
在我的控制器中,我想将图像保存到缩略图
目录中,如下所示
'thumbnail' => [
'driver' => 'local',
'root' => storage_path('app/public/relativeContentPath/thumbnail'),
'url' => env('APP_URL').'/storage',
'visibility' => 'thumbnail',
'permissions' => [
'file' => [
'public' => 0664,
'private' => 0600,
],
'dir' => [
'public' => 0775,
'private' => 0700,
],
],
],
$fileNameToStore = md5(time()).'.jpg';
$photoThumbnail = ImageResize::make($productContent)
->resize(80, 80, function ($constraint) { $constraint->aspectRatio(); } )
->encode('jpg',80);
Storage::disk('thumbnail')->put( $fileNameToStore, $photoThumbnail);
但它向我显示了错误
未定义索引:缩略图。我不知道为什么这个错误让我明白。任何帮助都将'visibility'=>'thumbnail',
更改为'visibility'=>'public',
它可以是公共的或私有的
,否则您不能按照doc设置任何内容您知道可见性
属性的用途吗?只是一个侧面question@lagbox实际上我不知道为什么要使用可见性