-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mirror of Gitee I1KGFY #150
Comments
水印没有生效的问题还是没有找到,我在本地环境测试是好的,正式环境不行。正式环境的gd扩展已安装,FreeType也有 |
已解决。问题是:需要清除浏览器缓存,刷新后就显示了 |
@Edward1108 针对第 3 个问题;上传图片到 OSS 是用于备份? 还是准备在网页中引用 OSS 的图片链接? |
@baijunyao 希望项目里上传的附件都可以保存到oss中。我目前项目是使用的Thinkphp6,以下是我的配置文件,仅供参考。 .env config/filesystem.php env('filesystem.driver', 'local'), // 磁盘列表 'disks' => [ 'local' => [ 'type' => 'local', 'root' => app()->getRuntimePath() . 'storage', ], 'public' => [ // 磁盘类型 'type' => 'local', // 磁盘路径 'root' => app()->getRootPath() . 'public/storage', // 磁盘路径对应的外部URL路径 'url' => '/storage', // 可见性 'visibility' => 'public', ], 'aliyun_dev' => [ 'type' => 'aliyun', 'accessId' => '', 'accessSecret' => '', 'bucket' => '', 'endpoint' => 'oss-cn-beijing.aliyuncs.com', 'url' => '',//不要斜杠结尾,此处为URL地址域名。 ], 'aliyun_prod' => [ 'type' => 'aliyun', 'accessId' => '', 'accessSecret' => '', 'bucket' => '', 'endpoint' => 'oss-cn-beijing-internal.aliyuncs.com', 'url' => '',//不要斜杠结尾,此处为URL地址域名。 ], ], ]; 这个方法是根据当前配置项自动构造文件的访问路径 /** * 域名连接 * @param $str * @return string */ public static function domainConnect($str) { if(empty($str)){ return ''; } $type = config('filesystem.disks.'.env('filesystem.driver').'.type'); $domain = config('filesystem.disks.'.env('filesystem.driver').'.url'); if(empty($domain)){ return ''; } if($type == 'local'){ $domain = app()->request->server('HTTP_HOST').$domain; } if (Str::endsWith($domain, ['/'])) { $domain = substr($domain, 0, -1); } $str = Str::startsWith($str, ['/']) ? $str : '/' . $str; return $domain . $str; } |
格式化上面的代码: 'disks' => [
'local' => [
'type' => 'local',
'root' => app()->getRuntimePath() . 'storage',
],
'public' => [ // 磁盘类型
'type' => 'local', // 磁盘路径
'root' => app()->getRootPath() . 'public/storage', // 磁盘路径对应的外部URL路径
'url' => '/storage', // 可见性
'visibility' => 'public',
],
'aliyun_dev' => [
'type' => 'aliyun',
'accessId' => '',
'accessSecret' => '',
'bucket' => '',
'endpoint' => 'oss-cn-beijing.aliyuncs.com',
'url' => '',//不要斜杠结尾,此处为URL地址域名。
],
'aliyun_prod' => [
'type' => 'aliyun',
'accessId' => '',
'accessSecret' => '',
'bucket' => '',
'endpoint' => 'oss-cn-beijing-internal.aliyuncs.com',
'url' => '',//不要斜杠结尾,此处为URL地址域名。
],
], /**
* 域名连接
*
* @param $str
* @return string
*/
public static function domainConnect($str) {
if(empty($str)){
return '';
}
$type = config('filesystem.disks.'.env('filesystem.driver').'.type');
$domain = config('filesystem.disks.'.env('filesystem.driver').'.url');
if(empty($domain)){
return '';
}
if($type == 'local'){
$domain = app()->request->server('HTTP_HOST').$domain;
}
if (Str::endsWith($domain, ['/'])) {
$domain = substr($domain, 0, -1);
}
$str = Str::startsWith($str, ['/']) ? $str : '/' . $str;
return $domain . $str;
} |
@Edward1108 功能已经开发完成 merge 到 master 了; 可以拉取最新的代码使用; 另外可以运行 |
@baijunyao 好的,谢谢。辛苦了 |
https://gitee.com/baijunyao/laravel-bjyblog/issues/I1KGFY
The text was updated successfully, but these errors were encountered: