作者 lyh

gx脚本demo

@@ -330,9 +330,9 @@ class LoginController extends BaseController @@ -330,9 +330,9 @@ class LoginController extends BaseController
330 $cos = new CosService(); 330 $cos = new CosService();
331 $cdnUrl = '/upload/p/1/image_other/2023-11/655d9c70b692e10129.png'; 331 $cdnUrl = '/upload/p/1/image_other/2023-11/655d9c70b692e10129.png';
332 $data = [ 332 $data = [
333 - 'text' => '大水印', 333 + 'image' => '/upload/m/image_other/2024-06/logo-162-2-1.png',
334 'gravity' => 'center', 334 'gravity' => 'center',
335 ]; 335 ];
336 - return $cos->addFieldImage($cdnUrl, $data); 336 + return $cos->addFieldImage($cdnUrl, $data,true);
337 } 337 }
338 } 338 }
@@ -186,9 +186,8 @@ class CosService @@ -186,9 +186,8 @@ class CosService
186 $domain = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';//cos域名 186 $domain = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';//cos域名
187 $url = $domain . $cdnUrl; 187 $url = $domain . $cdnUrl;
188 if($is_image){ 188 if($is_image){
189 - $data['image'] = $domain . $data['image'];  
190 $param = [ 189 $param = [
191 - 'image/'.$this->urlSafeBase64Encode($data['image'] ?? ''),//文字水印名称 190 + 'image/'.$this->urlSafeBase64Encode($domain.$data['image'] ?? ''),//文字水印名称
192 'gravity/'.($data['gravity'] ?? 'SouthEast'), 191 'gravity/'.($data['gravity'] ?? 'SouthEast'),
193 'dx/'.($data['dx'] ?? 0), 192 'dx/'.($data['dx'] ?? 0),
194 'dy/'. ($data['dy'] ?? 0), 193 'dy/'. ($data['dy'] ?? 0),