99 lines
4.4 KiB
PHP
99 lines
4.4 KiB
PHP
<?php
|
|
|
|
return [
|
|
// 默认磁盘
|
|
'default' => 'local',
|
|
// 磁盘列表
|
|
'disks' => [
|
|
'local' => [
|
|
'type' => 'local',
|
|
'root' => app()->getRuntimePath() . 'storage',
|
|
],
|
|
'public' => [
|
|
// 磁盘类型
|
|
'type' => 'local',
|
|
// 磁盘路径
|
|
'root' => app()->getRootPath() . 'public/storage',
|
|
// 磁盘路径对应的外部URL路径
|
|
'url' => '/storage',
|
|
// 可见性
|
|
'visibility' => 'public',
|
|
],
|
|
'image' => [
|
|
// 磁盘类型
|
|
'type' => 'local',
|
|
// 磁盘路径
|
|
'root' => app()->getRootPath() . 'public/storage/images',
|
|
// 磁盘路径对应的外部URL路径
|
|
'url' => '/storage/images',
|
|
// 可见性
|
|
'visibility' => 'public',
|
|
],
|
|
'video' => [
|
|
// 磁盘类型
|
|
'type' => 'local',
|
|
// 磁盘路径
|
|
'root' => app()->getRootPath() . 'public/storage/videos',
|
|
// 磁盘路径对应的外部URL路径
|
|
'url' => '/storage/videos',
|
|
// 可见性
|
|
'visibility' => 'public',
|
|
],
|
|
'public_qiniu' => [
|
|
// 磁盘类型
|
|
'type' => \filesystem\driver\Qiniu::class,
|
|
// bucker 名称
|
|
'bucket' => env('QINIU_CLOUD.BUCKET', 'orico-official-website'),
|
|
// 访问密钥
|
|
'access_key' => env('QINIU_CLOUD.ACCESS_KEY', 'dOsTum4a5qvhPTBbZRPX0pIOU7PZWRX7htKjztms'),
|
|
// 密钥
|
|
'secret_key' => env('QINIU_CLOUD.SECRET_KEY', 'KFxsGbnErkALFfeGdMa8QWTdodJbamMX0iznLe-q'),
|
|
// 外部URL
|
|
'base_url' => env('QINIU_CLOUD.BASE_URL', '//szw73dlk3.hn-bkt.clouddn.com'),
|
|
// 路径
|
|
'path_prefix' => '/storage',
|
|
// 文件名称回调,可为文件名添加特定标志,以便可以在后续识别
|
|
'filename_generator' => function (\think\file\UploadedFile $file, callable $context_generator = null): callable {
|
|
return function() use ($file, $context_generator) {
|
|
// 为文件名称添加配置名,以为后续可能根据文件名识别文件所属存储配置信息
|
|
$marker = '_' . base64_encode('public_qiniu');
|
|
$filename = $context_generator ? $context_generator($file) : null;
|
|
if ($filename == null) {
|
|
return date('Ymd') . '/' . md5(microtime(true) . $file->getPathname()) . $marker;
|
|
}
|
|
|
|
return $filename . $marker;
|
|
};
|
|
},
|
|
],
|
|
'video_qiniu' => [
|
|
// 磁盘类型
|
|
'type' => \filesystem\driver\Qiniu::class,
|
|
// bucker 名称
|
|
'bucket' => env('QINIU_CLOUD.BUCKET', 'orico-official-website'),
|
|
// 访问密钥
|
|
'access_key' => env('QINIU_CLOUD.ACCESS_KEY', 'dOsTum4a5qvhPTBbZRPX0pIOU7PZWRX7htKjztms'),
|
|
// 密钥
|
|
'secret_key' => env('QINIU_CLOUD.SECRET_KEY', 'KFxsGbnErkALFfeGdMa8QWTdodJbamMX0iznLe-q'),
|
|
// 外部URL
|
|
'base_url' => env('QINIU_CLOUD.BASE_URL', '//szw73dlk3.hn-bkt.clouddn.com'),
|
|
// 路径
|
|
'path_prefix' => '/storage/videos',
|
|
// 文件名称回调,可为文件名添加特定标志,以便可以在后续识别
|
|
'filename_generator' => function (\think\file\UploadedFile $file, callable $context_generator = null): callable {
|
|
return function() use ($file, $context_generator) {
|
|
// 为文件名称添加配置名,以为后续可能根据文件名识别文件所属存储配置信息
|
|
$marker = '_' . base64_encode('video_qiniu');
|
|
$filename = $context_generator ? $context_generator() : null;
|
|
if ($filename == null) {
|
|
return date('Ymd') . '/' . md5(microtime(true) . $file->getPathname()) . $marker;
|
|
}
|
|
|
|
return $filename . $marker;
|
|
};
|
|
},
|
|
]
|
|
// 更多的磁盘配置信息
|
|
],
|
|
];
|