|
...
|
...
|
@@ -216,22 +216,22 @@ class CosService |
|
|
|
$url = $url.'?watermark/2/'.implode('/',$param);
|
|
|
|
}
|
|
|
|
// 获取水印后的图片内容
|
|
|
|
// $imageContent = file_get_contents($url);
|
|
|
|
// // 使用 COS SDK 将图片重新上传并覆盖原图
|
|
|
|
// $cos = config('filesystems.disks.cos');
|
|
|
|
// $cosClient = new \Qcloud\Cos\Client([
|
|
|
|
// 'region' => $cos['region'],
|
|
|
|
// 'credentials' => [
|
|
|
|
// 'secretId' => $cos['credentials']['secretId'],
|
|
|
|
// 'secretKey' => $cos['credentials']['secretKey'],
|
|
|
|
// ],
|
|
|
|
// ]);
|
|
|
|
// // 上传并覆盖原图
|
|
|
|
// $cosClient->putObject([
|
|
|
|
// 'Bucket' => $cos['bucket'],
|
|
|
|
// 'Key' => $cdnUrl, // 去掉域名部分,得到存储桶内的路径
|
|
|
|
// 'Body' => $imageContent,
|
|
|
|
// ]);
|
|
|
|
$imageContent = file_get_contents($url);
|
|
|
|
// 使用 COS SDK 将图片重新上传并覆盖原图
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosClient = new Client([
|
|
|
|
'region' => $cos['region'],
|
|
|
|
'credentials' => [
|
|
|
|
'secretId' => $cos['credentials']['secretId'],
|
|
|
|
'secretKey' => $cos['credentials']['secretKey'],
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
// 上传并覆盖原图
|
|
|
|
$cosClient->putObject([
|
|
|
|
'Bucket' => $cos['bucket'],
|
|
|
|
'Key' => $cdnUrl, // 去掉域名部分,得到存储桶内的路径
|
|
|
|
'Body' => $imageContent,
|
|
|
|
]);
|
|
|
|
return $url;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|