Commit 6eddf1dc authored by 王源's avatar 王源 🎧

添加替换阿里云图片内部地址方法

parent c72fe953
...@@ -40,6 +40,7 @@ class Drawer ...@@ -40,6 +40,7 @@ class Drawer
} }
/** /**
* 下载网络图片
* @param string $url * @param string $url
* @param string $path * @param string $path
* @return string * @return string
...@@ -81,10 +82,19 @@ class Drawer ...@@ -81,10 +82,19 @@ class Drawer
$url = str_replace("%2F", "/", $url); $url = str_replace("%2F", "/", $url);
$url = str_replace("%3F", "?", $url); $url = str_replace("%3F", "?", $url);
$url = str_replace("%3D", "=", $url); $url = str_replace("%3D", "=", $url);
$url = str_replace("%26", "&", $url);
} }
return $url; return $this->handleOssUrl($url);
} }
// 替换阿里云图片内部地址
private function handleOssUrl($url)
{
if ($this->config->get('app_env') !== 'dev') {
$url = str_replace('huaperfect-file-service.oss-cn-hangzhou.aliyuncs.com', 'huaperfect-file-service.oss-cn-hangzhou-internal.aliyuncs.com', $url);
}
return $url;
}
/** /**
* description:下载文件到服务端 增加判断是否是webp 格式的图片处理 * description:下载文件到服务端 增加判断是否是webp 格式的图片处理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment