|
...
|
...
|
@@ -188,7 +188,7 @@ class CosService |
|
|
|
$url = $domain . $cdnUrl;
|
|
|
|
if($is_image){
|
|
|
|
$param = [
|
|
|
|
'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片
|
|
|
|
'image/'.urlSafeBase64Encode($domain.$data['image'] ?? ''),//图片
|
|
|
|
'gravity/'.($data['gravity'] ?? 'SouthEast'),
|
|
|
|
'dx/'.($data['dx'] ?? 0),
|
|
|
|
'dy/'. ($data['dy'] ?? 0),
|
|
...
|
...
|
@@ -199,13 +199,13 @@ class CosService |
|
|
|
$url = $url.'?watermark/1/'.implode('/',$param);
|
|
|
|
}else{
|
|
|
|
$param = [
|
|
|
|
'text/'.$this->urlSafeBase64Encode($data['text'] ?? ''),//文字水印名称
|
|
|
|
'text/'.urlSafeBase64Encode($data['text'] ?? ''),//文字水印名称
|
|
|
|
'gravity/'.($data['gravity'] ?? 'SouthEast'),
|
|
|
|
'dx/'.($data['dx'] ?? 10),
|
|
|
|
'dy/'. ($data['dy'] ?? 10),
|
|
|
|
'font/'.$this->urlSafeBase64Encode($data['font'] ?? 'tahoma.ttf'),//默认宋体
|
|
|
|
'font/'.urlSafeBase64Encode($data['font'] ?? 'tahoma.ttf'),//默认宋体
|
|
|
|
'fontsize/'.($data['fontsize'] ?? 24),//水印文字字体大小,单位为磅,缺省值13
|
|
|
|
'fill/'.$this->urlSafeBase64Encode($data['fill'] ?? '#3D3D3D'),//颜色
|
|
|
|
'fill/'.urlSafeBase64Encode($data['fill'] ?? '#3D3D3D'),//颜色
|
|
|
|
'dissolve/'.($data['dissolve'] ?? 50),//透明度
|
|
|
|
'degree/'.($data['degree'] ?? 0),//文字水印的旋转角度设置,取值范围为0 - 360,默认0
|
|
|
|
'batch/'.($data['batch'] ?? 0),//平铺水印功能
|
|
...
|
...
|
@@ -247,28 +247,6 @@ class CosService |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :腾讯云安全的base64
|
|
|
|
* @name :urlSafeBase64Encode
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/19 14:21
|
|
|
|
*/
|
|
|
|
public function urlSafeBase64Encode($data = '') {
|
|
|
|
if(empty($data)){
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
// 1. 使用标准的 BASE64 编码
|
|
|
|
$base64 = base64_encode($data);
|
|
|
|
// 2. 将加号(+)替换成连接号(-)
|
|
|
|
$base64 = str_replace('+', '-', $base64);
|
|
|
|
// 3. 将正斜线(/)替换成下划线(_)
|
|
|
|
$base64 = str_replace('/', '_', $base64);
|
|
|
|
// 4. 去掉末尾的等号(=)
|
|
|
|
$base64 = rtrim($base64, '=');
|
|
|
|
return $base64;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理9宫格数据
|
|
|
|
* @name :getPosition
|
|
|
|
* @author :lyh
|
...
|
...
|
|