From 8c9ba78ace6fc8f00688827b34be5e94473ef0cd Mon Sep 17 00:00:00 2001 From: franktguo Date: Fri, 15 Nov 2024 11:54:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=BD=AC=E7=A0=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Descriptions.php | 48 +++++++++++++------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/src/Descriptions.php b/src/Descriptions.php index 00fdd6a..395b877 100644 --- a/src/Descriptions.php +++ b/src/Descriptions.php @@ -2145,7 +2145,7 @@ public static function DetectVideo() { 'type' => 'object', 'properties' => array( 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), - 'Count' => array( 'type' => 'string', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), 'TimeInterval' => array( 'type' => 'numeric', 'location' => 'xml', ), ), ), @@ -3485,39 +3485,19 @@ public static function CreateDocProcessJobs() { 'type' => 'object', 'location' => 'xml', 'properties' => array( - 'SrcType' => array( - 'type' => 'string', - ), - 'TgtType' => array( - 'type' => 'string', - ), - 'SheetId' => array( - 'type' => 'integer', - ), - 'StartPage' => array( - 'type' => 'integer', - ), - 'EndPage' => array( - 'type' => 'integer', - ), - 'ImageParams' => array( - 'type' => 'string', - ), - 'DocPassword' => array( - 'type' => 'string', - ), - 'Comments' => array( - 'type' => 'integer', - ), - 'PaperDirection' => array( - 'type' => 'integer', - ), - 'Quality' => array( - 'type' => 'integer', - ), - 'Zoom' => array( - 'type' => 'integer', - ), + 'SrcType' => array( 'type' => 'string', 'location' => 'xml', ), + 'TgtType' => array( 'type' => 'string', 'location' => 'xml', ), + 'StartPage' => array( 'type' => 'integer', 'location' => 'xml', ), + 'EndPage' => array( 'type' => 'integer', 'location' => 'xml', ), + 'SheetId' => array( 'type' => 'integer', 'location' => 'xml', ), + 'PaperDirection' => array( 'type' => 'integer', 'location' => 'xml', ), + 'PaperSize' => array( 'type' => 'integer', 'location' => 'xml', ), + 'ImageParams' => array( 'type' => 'string', 'location' => 'xml', ), + 'Quality' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Zoom' => array( 'type' => 'integer', 'location' => 'xml', ), + 'ImageDpi' => array( 'type' => 'integer', 'location' => 'xml', ), + 'DocPassword' => array( 'type' => 'string', 'location' => 'xml', ), + 'Comments' => array( 'type' => 'integer', 'location' => 'xml', ), ), ), ), From f3aef06a30540ac88be3f7973c991eb2933bdbae Mon Sep 17 00:00:00 2001 From: franktguo Date: Fri, 15 Nov 2024 12:29:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BA=BA=E8=84=B8=E7=89=B9=E6=95=88?= =?UTF-8?q?=E6=8B=86=E5=88=86URL=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/imageFaceEffect.php | 21 ++++++++++++++++++--- src/Client.php | 1 + src/Descriptions.php | 21 +++++++++++++++++++++ src/Service.php | 1 + 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/sample/imageFaceEffect.php b/sample/imageFaceEffect.php index b10ca29..35b768d 100644 --- a/sample/imageFaceEffect.php +++ b/sample/imageFaceEffect.php @@ -13,10 +13,11 @@ 'secretId' => $secretId, 'secretKey' => $secretKey))); try { - // 人脸特效 https://cloud.tencent.com/document/product/460/47197 - $result = $cosClient->ImageFaceEffect(array( + // 人脸特效 + // 桶文件 + $result = $cosClient->imageFaceEffect(array( 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket - 'Key' => '', // ObjectKey + 'Key' => 'xxx.jpg', // ObjectKey 'type' => 'face-beautify', // 人脸特效类型。人脸美颜:face-beautify;人脸性别转换:face-gender-transformation;人脸年龄变化:face-age-transformation;人像分割:face-segmentation 'whitening' => 30, 'smoothing' => 10, @@ -26,6 +27,20 @@ 'age' => 18, )); print_r($result); + + // 第三方URL + $result = $cosClient->imageUrlFaceEffect(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'type' => 'face-beautify', // 人脸特效类型。人脸美颜:face-beautify;人脸性别转换:face-gender-transformation;人脸年龄变化:face-age-transformation;人像分割:face-segmentation + 'whitening' => 30, + 'smoothing' => 10, + 'faceLifting' => 70, + 'eyeEnlarging' => 70, + 'gender' => 1, + 'age' => 18, + 'detectUrl' => 'https://xxx.com/xxx.jpg', + )); + print_r($result); } catch (\Exception $e) { // 请求失败 echo($e); diff --git a/src/Client.php b/src/Client.php index 3aa1ac4..5af5d4a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -192,6 +192,7 @@ * @method object CloseOriginProtect(array $args) 关闭原图保护 * @method object ImageDetectFace(array $args) 人脸检测 * @method object ImageFaceEffect(array $args) 人脸特效 + * @method object ImageUrlFaceEffect(array $args) 人脸特效 * @method object IDCardOCR(array $args) 身份证识别 * @method object IDCardOCRByUpload(array $args) 身份证识别-上传时处理 * @method object GetLiveCode(array $args) 获取数字验证码 diff --git a/src/Descriptions.php b/src/Descriptions.php index 395b877..c04d4ae 100644 --- a/src/Descriptions.php +++ b/src/Descriptions.php @@ -12907,6 +12907,27 @@ public static function ImageFaceEffect() { ), ); } + + public static function ImageUrlFaceEffect() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?ci-process=face-effect', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ImageFaceEffectOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'type' => array( 'type' => 'string', 'location' => 'query', ), + 'whitening' => array( 'type' => 'integer', 'location' => 'query', ), + 'smoothing' => array( 'type' => 'integer', 'location' => 'query', ), + 'faceLifting' => array( 'type' => 'integer', 'location' => 'query', ), + 'eyeEnlarging' => array( 'type' => 'integer', 'location' => 'query', ), + 'gender' => array( 'type' => 'integer', 'location' => 'query', ), + 'age' => array( 'type' => 'integer', 'location' => 'query', ), + 'detectUrl' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'detect-url'), + ), + ); + } public static function ImageFaceEffectOutput() { return array( 'type' => 'object', diff --git a/src/Service.php b/src/Service.php index ce96d02..802d79e 100644 --- a/src/Service.php +++ b/src/Service.php @@ -3787,6 +3787,7 @@ public static function getService() { 'CloseOriginProtect' => Descriptions::CloseOriginProtect(), // 关闭原图保护 'ImageDetectFace' => Descriptions::ImageDetectFace(), // 人脸检测 'ImageFaceEffect' => Descriptions::ImageFaceEffect(), // 人脸特效 + 'ImageUrlFaceEffect' => Descriptions::ImageUrlFaceEffect(), // 人脸特效 'IDCardOCR' => Descriptions::IDCardOCR(), // 身份证识别 'IDCardOCRByUpload' => Descriptions::IDCardOCRByUpload(), // 身份证识别-上传时处理 'GetLiveCode' => Descriptions::GetLiveCode(), // 获取数字验证码 From b077e1973174d2981c079e967f1b6c1dd7d8bcd1 Mon Sep 17 00:00:00 2001 From: franktguo Date: Tue, 21 Jan 2025 14:48:10 +0800 Subject: [PATCH 3/4] =?UTF-8?q?x-ci-*header=E5=86=99=E5=85=A5=E7=AD=BE?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Signature.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Signature.php b/src/Signature.php index a812c3a..c01ac90 100644 --- a/src/Signature.php +++ b/src/Signature.php @@ -53,6 +53,9 @@ public function needCheckHeader( $header ) { if ( startWith( $header, 'x-cos-' ) ) { return true; } + if ( startWith( $header, 'x-ci-' ) ) { + return true; + } if ( in_array( $header, $this->signHeader ) ) { return true; } From b66e3f0429279ae7e654f760a8971908d4876d69 Mon Sep 17 00:00:00 2001 From: franktguo Date: Tue, 21 Jan 2025 20:20:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?ci=E8=A1=A5=E5=85=85=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/CreateDataset.php | 6 +++++- src/Descriptions.php | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/sample/CreateDataset.php b/sample/CreateDataset.php index 5eb0e78..4aca7d8 100644 --- a/sample/CreateDataset.php +++ b/sample/CreateDataset.php @@ -23,7 +23,11 @@ 'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。命名规则如下: 长度为1~32字符。 只能包含小写英文字母,数字,短划线(-)。 必须以英文字母和数字开头。;是否必传:是 'Description'=> 'test', // 数据集描述信息。长度为1~256个英文或中文字符,默认值为空。;是否必传:否 'TemplateId'=> 'Official:COSBasicMeta', // 指模板,在建立元数据索引时,后端将根据模板来决定收集哪些元数据。每个模板都包含一个或多个算子,不同的算子表示不同的元数据。目前支持的模板: Official:DefaultEmptyId:默认为空的模板,表示不进行元数据的采集。 Official:COSBasicMeta:基础信息模板,包含 COS 文件基础元信息算子,表示采集 COS 文件的名称、类型、ACL等基础元信息数据。 Official:FaceSearch:人脸检索模板,包含人脸检索、COS 文件基础元信息算子。Official:ImageSearch:图像检索模板,包含图像检索、COS 文件基础元信息算子。;是否必传:否 - + 'Version' => 'basic', // 数据集版本。basic、standard,默认为basic。 + 'Volume' => 0, // Version为basic时为50w。Version为standard时,默认为500w,可设置1-10000,单位w。传0采用默认值。 + 'TrainingMode' => 1, // 训练数据的来源模式。 + 'TrainingDataset' => '', // 训练数据的数据集名称。仅在TrainingMode为0时生效。 + 'TrainingURI' => '', // 训练数据的资源路径。仅在TrainingMode为1时生效。 )); // 请求成功 print_r($result); diff --git a/src/Descriptions.php b/src/Descriptions.php index c04d4ae..487de09 100644 --- a/src/Descriptions.php +++ b/src/Descriptions.php @@ -29,6 +29,7 @@ public static function CreateMediaTranscodeJobs() { 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), 'Tag' => array( 'location' => 'xml', 'type' => 'string', ), 'QueueId' => array( 'location' => 'xml', 'type' => 'string', ), + 'QueueType' => array( 'location' => 'xml', 'type' => 'string', ), 'CallBack' => array( 'location' => 'xml', 'type' => 'string', ), 'CallBackFormat' => array( 'location' => 'xml', 'type' => 'string', ), 'CallBackType' => array( 'location' => 'xml', 'type' => 'string', ), @@ -271,6 +272,33 @@ public static function CreateMediaTranscodeJobs() { 'State' => array( 'type' => 'string', 'location' => 'xml', ), ), ), + 'Subtitles' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Subtitle' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'name' => 'Subtitle', + 'sentAs' => 'Subtitle', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Embed' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontType' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontSize' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontColor' => array( 'type' => 'string', 'location' => 'xml', ), + 'OutlineColor' => array( 'type' => 'string', 'location' => 'xml', ), + 'VMargin' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), ), ), 'CallBackMqConfig' => array( @@ -282,6 +310,15 @@ public static function CreateMediaTranscodeJobs() { 'MqName' => array( 'type' => 'string', 'location' => 'xml', ), ), ), + 'CallBackKafkaConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( 'type' => 'string', 'location' => 'xml', ), + 'InstanceId' => array( 'type' => 'string', 'location' => 'xml', ), + 'Topic' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), ), ); } @@ -19290,6 +19327,11 @@ public static function CreateDataset() { 'DatasetName' => array( 'location' => 'json', 'type' => 'string', ), 'Description' => array( 'location' => 'json', 'type' => 'string', ), 'TemplateId' => array( 'location' => 'json', 'type' => 'string', ), + 'Version' => array( 'location' => 'json', 'type' => 'string', ), + 'Volume' => array( 'location' => 'json', 'type' => 'integer', ), + 'TrainingMode' => array( 'location' => 'json', 'type' => 'integer', ), + 'TrainingDataset' => array( 'location' => 'json', 'type' => 'string', ), + 'TrainingURI' => array( 'location' => 'json', 'type' => 'string', ), ), );