|
...
|
...
|
@@ -62,5 +62,32 @@ class CosService |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据远程图片地址上传
|
|
|
|
* @param $file_url
|
|
|
|
* @param $path
|
|
|
|
* @param $filename
|
|
|
|
* @return string
|
|
|
|
* @author Akun
|
|
|
|
* @date 2023/09/21 9:39
|
|
|
|
*/
|
|
|
|
public function uploadRemote($file_url,$path,$filename)
|
|
|
|
{
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosClient = new Client([
|
|
|
|
'region' => $cos['region'],
|
|
|
|
'credentials' => [
|
|
|
|
'secretId' => $cos['credentials']['secretId'],
|
|
|
|
'secretKey' => $cos['credentials']['secretKey'],
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
$key = $path.'/'.$filename;
|
|
|
|
$cosClient->putObject([
|
|
|
|
'Bucket' => $cos['bucket'],
|
|
|
|
'Key' => $key,
|
|
|
|
'Body' => fopen($file_url, 'r'),
|
|
|
|
]);
|
|
|
|
return $key;
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|