简介
本文档提供关于图片处理模板接口的 API 概览和 SDK 示例代码。
新增图片处理模板
功能说明
用于新增图片处理模板。
方法原型
public Guzzle\\Service\\Resource\\Model createMediaPicProcessTemplate(array $args = array());
请求示例
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的 region 可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为 http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {// https://cloud.tencent.com/document/product/436/67225 新增图片处理模板$result = $cosClient->createMediaPicProcessTemplate(array('Bucket' => 'examplebucket-125000000', //存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket'Tag' => 'PicProcess','Name' => 'PicProcess-Template-Name','PicProcess' => array('IsPicInfo' => '','ProcessRule' => 'imageMogr2/rotate/90',),));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数说明
Request 中的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 | 限制 |
Tag | Request | 模板类型:PictureProcess | String | 是 | 无 |
PicProcess | Request | 容器格式 | Container | 是 | 无 |
Container 类型 PicProcess 的具体数据描述如下:
返回结果示例
GuzzleHttp\\Command\\Result Object([Body] => GuzzleHttp\\Psr7\\Stream Object([stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #88[size:GuzzleHttp\\Psr7\\Stream:private] =>[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1[readable:GuzzleHttp\\Psr7\\Stream:private] => 1[writable:GuzzleHttp\\Psr7\\Stream:private] => 1[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array())[RequestId] => NjJhODc2NDRfZmNjYTNiOAUIODUDmZmYjQ=[ContentType] => application/xml[ContentLength] => 594[Bucket] => examplebucket-125000000[Location] => examplebucket-125000000.ci.ap-guangzhou.myqcloud.com/template[Response] => Array([RequestId] => NjJhODc2NDRfZmNjYTNiOAUIODUDmZmYjQ=[Template] => Array([TemplateId] => t10e5880d9efdfd09eb19basdasd[Name] => PicProcess-Template-Name[State] => Normal[Tag] => PicProcess[CreateTime] => 2022-06-14T19:51:32+0800[UpdateTime] => 2022-06-14T19:51:32+0800[BucketId] => examplebucket-125000000[Category] => Custom[PicProcess] => Array([IsPicInfo] => true[ProcessRule] => imageMogr2/rotate/90))))
更新图片处理模板
功能说明
用于更新图片处理模板。
方法原型
public Guzzle\\Service\\Resource\\Model updateMediaPicProcessTemplate(array $args = array());
请求示例
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的 region 可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为 http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {// https://cloud.tencent.com/document/product/436/67228 更新图片处理模板$result = $cosClient->updateMediaPicProcessTemplate(array('Bucket' => 'examplebucket-125000000', //存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket'Key' => '', // TemplateId'Tag' => 'PicProcess','Name' => 'PicProcess-Template-Name','PicProcess' => array('IsPicInfo' => '','ProcessRule' => 'imageMogr2/rotate/90',),));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数说明
Request 中的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 | 限制 |
Tag | Request | 模板类型:PictureProcess | String | 是 | 无 |
PicProcess | Request | 容器格式 | Container | 是 | 无 |
Container 类型 PicProcess 的具体数据描述如下:
返回结果示例
GuzzleHttp\\Command\\Result Object([Body] => GuzzleHttp\\Psr7\\Stream Object([stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #88[size:GuzzleHttp\\Psr7\\Stream:private] =>[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1[readable:GuzzleHttp\\Psr7\\Stream:private] => 1[writable:GuzzleHttp\\Psr7\\Stream:private] => 1[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array())[RequestId] => NjJhODc2Y2JfNzgwYzAIUJOIUDJIOSxMjdmZDQ=[ContentType] => application/xml[ContentLength] => 596[Key] => t10e5880d9efdfd61bb11d09eb19b[Bucket] => examplebucket-125000000[Location] => examplebucket-125000000.ci.ap-guangzhou.myqcloud.com/template/t10e5880d9efdfd61bb11d09eb19b[Response] => Array([RequestId] => NjJhODc2Y2JfNzgwYzAIUJOIUDJIOSxMjdmZDQ=[Template] => Array([TemplateId] => t10e5880d9efdfd61bb11d09eb19b[Name] => PicProcess-Template-Name[State] => Normal[Tag] => PicProcess[CreateTime] => 2022-06-14T19:51:32+0800[UpdateTime] => 2022-06-14T19:53:47+0800[BucketId] => examplebucket-125000000[Category] => Custom[PicProcess] => Array([IsPicInfo] => true[ProcessRule] => imageMogr2/rotate/90))))