新增
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require 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/460/63901
|
||||
$result = $cosClient->imageSearch(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // ObjectKey
|
||||
'MatchThreshold' => 0, // 出参 Score 中,只有超过 MatchThreshold 值的结果才会返回。默认为0
|
||||
'Offset' => 0, // 起始序号,默认值为0
|
||||
'Limit' => 10, // 返回数量,默认值为10,最大值为100
|
||||
'Filter' => '', // 针对入库时提交的 Tags 信息进行条件过滤。支持>、>=、<、<=、=、!=,多个条件之间支持 AND 和 OR 进行连接
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require 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/460/63900
|
||||
$result = $cosClient->imageSearchAdd(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // ObjectKey
|
||||
'EntityId' => '', // 物品 ID,最多支持64个字符。若 EntityId 已存在,则对其追加图片
|
||||
'CustomContent' => '', // 用户自定义的内容,最多支持4096个字符,查询时原样带回
|
||||
'Tags' => '', // 图片自定义标签,最多不超过10个,json 字符串,格式为 key:value 对
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require 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/460/63902
|
||||
$result = $cosClient->imageSearchDelete(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // ObjectKey
|
||||
'EntityId' => '', // 物品 ID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require 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/460/63899
|
||||
$result = $cosClient->imageSearchOpen(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'MaxCapacity' => 10000, // 图库容量限制
|
||||
'MaxQps' => 10, // 图库访问限制,默认10
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->abortMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'UploadId' => 'string',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/30116
|
||||
$result = $cosClient->addHotLink(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Urls' => array(
|
||||
'www.example1.com',
|
||||
'www.example2.com',
|
||||
'www.example3.com',
|
||||
),
|
||||
'Type' => 'white',
|
||||
));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$result = $cosClient->appendObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'Position' => 0, //追加对象位置
|
||||
'Body' => fopen($local_path, 'rb'),//读取文件内容
|
||||
));
|
||||
/*
|
||||
$result = $cosClient->appendObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'Position' => (integer)$result['Position'], //取出上一个追加文件的对象位置进行追加
|
||||
'Body' => "hello", //文件流
|
||||
));
|
||||
*/
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/30108
|
||||
$result = $cosClient->bindCiService(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate();
|
||||
$blindWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg");
|
||||
$blindWatermarkTemplate->setType(2);
|
||||
$blindWatermarkTemplate->setLevel(3);
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'ImageHandleParam' => $blindWatermarkTemplate->queryString(),
|
||||
'SaveAs' => '/data/exampleobject'
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/71515 取消存量任务
|
||||
$result = $cosClient->cancelInventoryTriggerJob(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // jobId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->cancelLiveVideoAuditing(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // jobId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->getBucketAcl(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
$statusCode = $e->getStatusCode(); // 获取错误码
|
||||
$errorMessage = $e->getMessage(); // 获取错误信息
|
||||
$requestId = $e->getRequestId(); // 获取错误的requestId
|
||||
$errorCode = $e->getCosErrorCode(); // 获取错误名称
|
||||
$request = $e->getRequest(); // 获取完整的请求
|
||||
$response = $e->getResponse(); // 获取完整的响应
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate();
|
||||
$imageMogrTemplate->thumbnailByScale(50);
|
||||
$imageMogrTemplate->rotate(50);
|
||||
$imageViewTemplate = new Qcloud\Cos\ImageParamTemplate\ImageViewTemplate();
|
||||
$imageViewTemplate->setMode(1);
|
||||
$imageViewTemplate->setWidth(400);
|
||||
$imageViewTemplate->setHeight(600);
|
||||
$imageViewTemplate->setQuality(1, 85);
|
||||
$ciParamTransformation = new Qcloud\Cos\ImageParamTemplate\CIParamTransformation();
|
||||
$ciParamTransformation->addRule($imageMogrTemplate);
|
||||
$ciParamTransformation->addRule($imageViewTemplate);
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'ImageHandleParam' => $ciParamTransformation->queryString(),
|
||||
'SaveAs' => '/data/exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->closeImageSlim(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/30122
|
||||
$result = $cosClient->closeOriginProtect(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->completeMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'UploadId' => 'string',
|
||||
'Parts' => array(
|
||||
array(
|
||||
'ETag' => 'string',
|
||||
'PartNumber' => integer,
|
||||
),
|
||||
array(
|
||||
'ETag' => 'string',
|
||||
'PartNumber' => integer,
|
||||
)),
|
||||
// ... repeated
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$result = $cosClient->copy(
|
||||
$bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
$key = 'exampleobject',
|
||||
$copySource = array(
|
||||
'Region' => '<sourceRegion>',
|
||||
'Bucket' => '<sourceBucket>',
|
||||
'Key' => '<sourceKey>',
|
||||
)
|
||||
);
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->copyObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'CopySource' => urlencode('examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject'), //请注意这里需要urlencode,防止因特殊字符产生的400或404错误
|
||||
'MetadataDirective' => 'Replaced',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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
|
||||
$token = "COS_TMPTOKEN"; //如果使用永久密钥不需要填入token,如果使用临时密钥需要填入,临时密钥生成和使用指引参见https://cloud.tencent.com/document/product/436/14048
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region, //园区
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'timeout' => 10, //超时时间
|
||||
'connect_timeout' => 10, //连接超时时间
|
||||
'ip' => '', //ip
|
||||
'port' => '', //端口
|
||||
'endpoint' => '', //endpoint
|
||||
'domain' => '', //domain可以填写用户自定义域名,或者桶的全球加速域名
|
||||
'proxy' => '', //代理服务器
|
||||
'retry' => 10, //重试次数
|
||||
'userAgent' => '', //UA
|
||||
'allow_redirects' => false, //是否follow302
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey,
|
||||
'token' => $token,
|
||||
'anonymous' => true, //匿名模式
|
||||
),
|
||||
'timezone' => 'PRC', //时区
|
||||
'locationWithSchema' => true //Location中是否包含schema
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交一个翻译任务 https://cloud.tencent.com/document/product/460/84799
|
||||
$result = $cosClient->createAiTranslationJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Translation',
|
||||
'Input' => array(
|
||||
'Object' => 'test.docx',
|
||||
'Lang' => 'zh',
|
||||
'Type' => 'docx',
|
||||
// 'BasicType' => '',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '',
|
||||
// 'NoNeedOutput' => 'true',
|
||||
'Translation' => array(
|
||||
'Lang' => 'en',
|
||||
'Type' => 'docx',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'xxx.txt',
|
||||
),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交一个分词任务 https://cloud.tencent.com/document/product/460/84800
|
||||
$result = $cosClient->createAiWordsGeneralizeJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'WordsGeneralize',
|
||||
'Input' => array(
|
||||
'Object' => 'test.txt',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
'WordsGeneralize' => array(
|
||||
'NerMethod' => 'DL',
|
||||
'SegMethod' => 'MIX',
|
||||
),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createBucket(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createDocProcessJobs(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'DocProcess', //任务的 Tag:DocProcess 固定值
|
||||
'Input' => array(
|
||||
'Object' => 'Append功能测试.pdf' //待操作的文件对象
|
||||
),
|
||||
'Operation' => array(
|
||||
'DocProcess' => array(
|
||||
'SrcType' => 'pdf', //源数据的后缀类型
|
||||
'TgtType' => 'png', //转换输出目标文件类型
|
||||
'SheetId' => 0, //表格文件参数,转换第 X 个表,默认为1
|
||||
'StartPage' => 1, //从第 X 页开始转换,默认为1
|
||||
'EndPage' => 3, //转换至第 X 页,默认为-1,即转换全部页
|
||||
'ImageParams' => '', //转换后的图片处理参数
|
||||
'DocPassword' => '', //Office 文档的打开密码
|
||||
'Comments' => 0, //是否隐藏批注和应用修订,默认为 0
|
||||
'PaperDirection' => 0, //表格文件转换纸张方向,默认为0
|
||||
'Quality' => 100, //生成预览图的图片质量,取值范围 [1-100],默认值100
|
||||
'Zoom' => 100, //预览图片的缩放参数,取值范围[10-200], 默认值100
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region, //存储桶的地域
|
||||
'Bucket' => 'examplebucket-1250000000', //存储结果的存储桶
|
||||
'Object' => 'pic-${Page}.jpg', //输出文件路径
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/83112 提交多文件打包压缩任务-异步
|
||||
$result = $cosClient->createFileCompressJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'FileCompress',
|
||||
'Operation' => array(
|
||||
'UserData' => 'xxx',
|
||||
'FileCompressConfig' => array(
|
||||
'Flatten' => '0',
|
||||
'Format' => 'zip',
|
||||
// 'UrlList' => 'test/index.csv',
|
||||
// 'Prefix' => 'test/',
|
||||
'Keys' => array(
|
||||
'object1', // 待压缩桶文件
|
||||
'object2', // 待压缩桶文件
|
||||
'object3', // 待压缩桶文件
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'output/test.zip',
|
||||
),
|
||||
),
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/83108 提交哈希值计算任务-异步
|
||||
$result = $cosClient->createFileHashCodeJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'FileHashCode',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'UserData' => 'xxx',
|
||||
'FileHashCodeConfig' => array(
|
||||
'Type' => 'MD5',
|
||||
'AddToHeader' => 'true',
|
||||
),
|
||||
),
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/83110 提交文件解压任务-异步
|
||||
$result = $cosClient->createFileUncompressJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'FileUncompress',
|
||||
'Input' => array(
|
||||
'Object' => 'test.zip',
|
||||
),
|
||||
'Operation' => array(
|
||||
'UserData' => 'xxx',
|
||||
'FileUncompressConfig' => array(
|
||||
'Prefix' => 'prefix',
|
||||
'PrefixReplaced' => '1',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
),
|
||||
),
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'folder/',
|
||||
'Body' => "",
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// https://cloud.tencent.com/document/product/436/71516 触发批量存量任务
|
||||
// 1. 触发任务(工作流)https://cloud.tencent.com/document/product/460/76887
|
||||
$result = $cosClient->createInventoryTriggerJob(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Name' => '存量触发任务名称',
|
||||
'Type' => 'Workflow',
|
||||
'Input' => array(
|
||||
// 'Manifest' => '',
|
||||
// 'UrlFile' => '',
|
||||
// 'Prefix' => '',
|
||||
'Object' => 'test01.png',
|
||||
),
|
||||
'Operation' => array(
|
||||
'WorkflowIds' => 'w9938ed4b1435448783xxxxxxxxxxxxx',
|
||||
// 'TimeInterval' => array(
|
||||
// 'Start' => '',
|
||||
// 'End' => '',
|
||||
// ),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
// 2. 触发任务(独立节点)https://cloud.tencent.com/document/product/460/80155
|
||||
$result = $cosClient->createInventoryTriggerJob(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Name' => '存量触发任务名称',
|
||||
'Type' => 'Job',
|
||||
'Input' => array(
|
||||
// 'Manifest' => '',
|
||||
// 'UrlFile' => '',
|
||||
// 'Prefix' => '',
|
||||
'Object' => 'test01.png',
|
||||
),
|
||||
'Operation' => array(
|
||||
'Tag' => '',
|
||||
'QueueId' => '',
|
||||
'QueueType' => '',
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'End' => '',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => '',
|
||||
'Bucket' => '',
|
||||
'Object' => '',
|
||||
'AuObject' => '',
|
||||
'SpriteObject' => '',
|
||||
'StreamExtract' => array(
|
||||
'Index' => '',
|
||||
'Object' => '',
|
||||
),
|
||||
),
|
||||
'JobParam' => array(
|
||||
// 根据Tag输入相应参数,参数详情参考 https://cloud.tencent.com/document/product/460/80155
|
||||
'TemplateId' => '',
|
||||
'TranscodeTemplateId' => '',
|
||||
'WatermarkTemplateId' => '',
|
||||
// 'Animation' => ...,
|
||||
// 'Transcode' => ...,
|
||||
// 'SmartCover' => ...,
|
||||
// 'DigitalWatermark' => ...,
|
||||
// 'Watermark' => ...,
|
||||
// 'RemoveWatermark' => ...,
|
||||
// 'Snapshot' => ...,
|
||||
// 'SpeechRecognition' => ...,
|
||||
// 'ConcatTemplate' => ...,
|
||||
// 'VoiceSeparate' => ...,
|
||||
// 'VideoMontage' => ...,
|
||||
// 'SDRtoHDR' => ...,
|
||||
// 'VideoProcess' => ...,
|
||||
// 'SuperResolution' => ...,
|
||||
// 'Segment' => ...,
|
||||
// 'ExtractDigitalWatermark' => ...,
|
||||
// 'VideoTag' => ...,
|
||||
// 'TtsTpl' => ...,
|
||||
// 'NoiseReduction' => ...,
|
||||
),
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createM3U8PlayListJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'StartTime' => 1679386006,
|
||||
'EndTime' => 1679386006,
|
||||
'Operation' => array(
|
||||
'M3U8List' => array(
|
||||
array(
|
||||
'BucketId' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Index' => '0',
|
||||
'ObjectPath' => 'test1.m3u8',
|
||||
),
|
||||
array(
|
||||
'BucketId' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Index' => '0',
|
||||
'ObjectPath' => 'test2.m3u8',
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'xxx.m3u8',
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54001
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaAnimationJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Animation',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't1de276cbdab16xxxxxxxxxxxxxxxxxxxxx',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'Animation.gif',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaAnimationJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Animation',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'Animation' => array(
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'AnimateOnlyKeepKeyFrame' => '',
|
||||
'AnimateTimeIntervalOfFrame' => '',
|
||||
'AnimateFramesPerSecond' => '',
|
||||
'Quality' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'Animation.gif',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createMediaAnimationTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Animation',
|
||||
'Name' => 'Animation-Template-Name',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'AnimateOnlyKeepKeyFrame' => '',
|
||||
'AnimateTimeIntervalOfFrame' => '',
|
||||
'AnimateFramesPerSecond' => '',
|
||||
'Quality' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54013
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaConcatJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Concat',
|
||||
'CallBack' => 'https://example.com/callback',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 'asdfafiahfiushdfisdhfuis',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'concat-video02.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaConcatJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Concat',
|
||||
'CallBack' => 'https://example.com/callback',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'concat-video03.mp4',
|
||||
),
|
||||
'ConcatTemplate' => array(
|
||||
'ConcatFragments' => array(
|
||||
array(
|
||||
'Url' => 'https://example.com/video01.mp4',
|
||||
'Mode' => 'Start',
|
||||
// 'StartTime' => '0',
|
||||
// 'EndTime' => '7',
|
||||
),
|
||||
array(
|
||||
'Url' => 'https://example.com/video02.mp4',
|
||||
'Mode' => 'Start',
|
||||
// 'StartTime' => '0',
|
||||
// 'EndTime' => '10',
|
||||
),
|
||||
// ... repeated
|
||||
),
|
||||
'Index' => 1,
|
||||
'Container' => array(
|
||||
'Format' => 'mp4'
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'mp3',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'H.264',
|
||||
'Bitrate' => '1000',
|
||||
'Width' => '1280',
|
||||
'Height' => '',
|
||||
'Fps' => '30',
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54041 新增拼接模板
|
||||
$result = $cosClient->createMediaConcatTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Concat',
|
||||
'Name' => 'Concat-Template-Name',
|
||||
'ConcatTemplate' => array(
|
||||
'ConcatFragments' => array(
|
||||
array(
|
||||
'Mode' => 'Start',
|
||||
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/video01.mp4',
|
||||
),
|
||||
array(
|
||||
'Mode' => 'End',
|
||||
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/video02.mp4',
|
||||
),
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'h.264',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Bitrate' => '',
|
||||
'Remove' => 'false',
|
||||
),
|
||||
'Container' => array(
|
||||
'Format' => 'mp4',
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/65999
|
||||
$result = $cosClient->createMediaDigitalWatermarkJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'DigitalWatermark',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'DigitalWatermark' => array(
|
||||
'Message' => '123456789ab',
|
||||
'Type' => 'Text',
|
||||
'Version' => 'V1',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'DigitalWatermark.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/66007
|
||||
$result = $cosClient->createMediaExtractDigitalWatermarkJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'ExtractDigitalWatermark',
|
||||
'Input' => array(
|
||||
'Object' => 'DigitalWatermark.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'ExtractDigitalWatermark' => array(
|
||||
'Type' => 'Text',
|
||||
'Version' => 'V1',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58307 新增极速高清转码模板
|
||||
$result = $cosClient->createMediaHighSpeedHdTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'HighSpeedHd',
|
||||
'Name' => 'HighSpeedHd-Template-Name',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Profile' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
'Gop' => '',
|
||||
'Preset' => '',
|
||||
'Bufsize' => '',
|
||||
'Maxrate' => '',
|
||||
'HlsTsTime' => '',
|
||||
'Pixfmt' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'IsCheckReso' => '',
|
||||
'ResoAdjMethod' => '',
|
||||
'IsHdr2Sdr' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58335
|
||||
$result = $cosClient->CreateMediaJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Transcode', // 可选,单一任务时,优先以Operation.Tag为准,当Operation无Tag参数时,该参数生效
|
||||
'CallBack' => '',
|
||||
'Input' => array(
|
||||
'Object' => 'example.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
array(
|
||||
'Tag' => 'Transcode',
|
||||
'TemplateId' => 't04e1ab86554984f1aa17cxxxxxxxxxxxxxx',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'video01.mp4',
|
||||
),
|
||||
'WatermarkTemplateId' => array(
|
||||
't112d18d9b2a9b430e91dxxxxxxxxxxxxxx',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Tag' => 'Transcode',
|
||||
'TemplateId' => 't04e1ab86554984f1aa17xxxxxxxxxxxxxx',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'video02.mp4',
|
||||
),
|
||||
'WatermarkTemplateId' => array(
|
||||
't1bf713bb5c6a5496e859axxxxxxxxxxxxxx',
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/84796
|
||||
$result = $cosClient->createMediaNoiseReductionJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'NoiseReduction',
|
||||
'Input' => array(
|
||||
'Object' => 'sound01.mp3',
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '',
|
||||
// 'NoiseReduction' => array(
|
||||
// 'Format' => '',
|
||||
// 'SampleRate' => '',
|
||||
// ),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'NoiseReduction.mp3',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/67194
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaPicProcessJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'PicProcess',
|
||||
'Input' => array(
|
||||
'Object' => 'test01.png'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't1648745f76c354e8ad8a09sd890ad80a8d',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'picprocess.jpg',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaPicProcessJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'PicProcess',
|
||||
'Input' => array(
|
||||
'Object' => 'test01.png'
|
||||
),
|
||||
'Operation' => array(
|
||||
'PicProcess' => array(
|
||||
'IsPicInfo' => '',
|
||||
'ProcessRule' => '',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'picprocess.jpg',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/76906
|
||||
$result = $cosClient->createMediaQualityEstimateJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'QualityEstimate',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
// 'QualityEstimateConfig' => array(
|
||||
// 'Rotate' => '',
|
||||
// 'Mode' => '',
|
||||
// ),
|
||||
),
|
||||
'CallBack' => 'http://xxx.com/callback',
|
||||
'CallBackFormat' => 'JSON',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
// 提交 SDR to HDR 任务 https://cloud.tencent.com/document/product/436/60754
|
||||
$result = $cosClient->createMediaSDRtoHDRJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SDRtoHDR',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TranscodeTemplateId' => '',
|
||||
'WatermarkTemplateId' => '',
|
||||
'SDRtoHDR' => array(
|
||||
'HdrMode' => 'HLG',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'SDRtoHDR.flv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/67186
|
||||
$result = $cosClient->createMediaSegmentJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Segment',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'Segment' => array(
|
||||
'Format' => 'mkv',
|
||||
'Duration' => '5',
|
||||
'HlsEncrypt' => array(
|
||||
'IsHlsEncrypt' => 'false',
|
||||
'UriKey' => '',
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'Segment-trans${Number}.mkv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54017
|
||||
$result = $cosClient->createMediaSmartCoverJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SmartCover',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'TemplateId' => '', // 使用模版
|
||||
'SmartCover' => array(
|
||||
'Format' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Count' => '',
|
||||
'DeleteDuplicates' => '',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'SmartCover-${Number}.jpg',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建智能封面模板 https://cloud.tencent.com/document/product/460/84734
|
||||
$result = $cosClient->createMediaSmartCoverTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SmartCover',
|
||||
'Name' => 'media-smartcover-name',
|
||||
'SmartCover' => array(
|
||||
'Format' => 'jpg',
|
||||
'Width' => '1280',
|
||||
'Height' => '960',
|
||||
'Count' => '3',
|
||||
'DeleteDuplicates' => 'true',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/76933
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaSnapshotJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Snapshot',
|
||||
'CallBack' => 'https://example.com/callback',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 'asdfafiahfiushdfisdhfuis',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'snapshot-${Number}.jpg',
|
||||
// 'SpriteObject' => 'sprite-${Number}.jpg',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaSnapshotJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Snapshot',
|
||||
'CallBack' => 'https://example.com/callback',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'snapshot-${Number}.jpg',
|
||||
),
|
||||
'Snapshot' => array(
|
||||
'Mode' => 'Average',
|
||||
'Start' => 3,
|
||||
'TimeInterval' => '',
|
||||
'Count' => 3,
|
||||
'Width' => '1280',
|
||||
'Height' => '',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54029 新增截图模板
|
||||
$result = $cosClient->createMediaSnapshotTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Snapshot',
|
||||
'Name' => 'Snapshot-Template-Name',
|
||||
'Snapshot' => array(
|
||||
'Mode' => '',
|
||||
'Start' => '',
|
||||
'TimeInterval' => '',
|
||||
'Count' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/84787
|
||||
$result = $cosClient->createMediaStreamExtractJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'StreamExtract',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
'Output' => array(
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Region' => $region,
|
||||
'StreamExtracts' => array(
|
||||
array(
|
||||
'Index' => '0',
|
||||
'Object' => 'output/out0.mp4',
|
||||
),
|
||||
array(
|
||||
'Index' => '1',
|
||||
'Object' => 'output/out1.mp4',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'CallBack' => 'http://xxx.com/callback',
|
||||
'CallBackFormat' => 'JSON',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/67210
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaSuperResolutionJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SuperResolution',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' =>'t19ea5e0c0b7054d7b904axxxxxxxxxxx',
|
||||
'TranscodeTemplateId' =>'t0b612860a293f41078xxxxxxxxxxx',
|
||||
'WatermarkTemplateId' =>'t185e2e24551b24259a02xxxxxxxxxxx',
|
||||
'DigitalWatermark' => array(
|
||||
'Message' => 'xxx',
|
||||
'Type' => 'Text',
|
||||
'Version' => 'V1',
|
||||
'IgnoreError' => 'true',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'SuperResolution.flv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaSuperResolutionJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SuperResolution',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'SuperResolution' => array(
|
||||
'Resolution' => '',
|
||||
'EnableScaleUp' => '',
|
||||
),
|
||||
'Transcode' => array(
|
||||
'Tag' => '',
|
||||
'Name' => '',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Remove' => '',
|
||||
'Profile' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
'Gop' => '',
|
||||
'Preset' => '',
|
||||
'Bufsize' => '',
|
||||
'Maxrate' => '',
|
||||
'HlsTsTime' => '',
|
||||
'Pixfmt' => '',
|
||||
'LongShortMode' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
'Remove' => '',
|
||||
'KeepTwoTracks' => '',
|
||||
'SwitchTrack' => '',
|
||||
'SampleFormat' => '',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'AdjDarMethod' => '',
|
||||
'IsCheckReso' => '',
|
||||
'ResoAdjMethod' => '',
|
||||
'IsCheckVideoBitrate' => '',
|
||||
'VideoBitrateAdjMethod' => '',
|
||||
'IsCheckAudioBitrate' => '',
|
||||
'AudioBitrateAdjMethod' => '',
|
||||
'DeleteMetadata' => '',
|
||||
'IsHdr2Sdr' => '',
|
||||
'HlsEncrypt' => array(
|
||||
'IsHlsEncrypt' => '',
|
||||
'UriKey' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
'Watermark' => array(
|
||||
'Type' => '',
|
||||
'Pos' => '',
|
||||
'LocMode' => '',
|
||||
'Dx' => '',
|
||||
'Dy' => '',
|
||||
'StartTime' => '',
|
||||
'EndTime' => '',
|
||||
'Image' => array(
|
||||
'Url' => '',
|
||||
'Mode' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Transparency' => '',
|
||||
'Background' => '',
|
||||
),
|
||||
'Text' => array(
|
||||
'FontSize' => '',
|
||||
'FontType' => '',
|
||||
'FontColor' => '',
|
||||
'Transparency' => '',
|
||||
'Text' => '',
|
||||
),
|
||||
),
|
||||
'DigitalWatermark' => array(
|
||||
'Message' => '',
|
||||
'Type' => '',
|
||||
'Version' => '',
|
||||
'IgnoreError' => '',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'SuperResolution.flv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createMediaSuperResolutionTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SuperResolution',
|
||||
'Name' => 'SuperResolution-Template-Name',
|
||||
'Resolution' => '',
|
||||
'EnableScaleUp' => '',
|
||||
'Version' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54009
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaTranscodeJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Transcode',
|
||||
'Input' => array(
|
||||
'Object' => 'example.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
'FreeTranscode' => 'true', // 闲时转码
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'video02.mp4',
|
||||
),
|
||||
'Watermark' => array(
|
||||
array(
|
||||
'Type' => 'Text',
|
||||
'LocMode' => 'Absolute',
|
||||
'Dx' => '64',
|
||||
'Dy' => '64',
|
||||
'Pos' => 'TopRight',
|
||||
'Text' => array(
|
||||
'Text' => '第一个水印',
|
||||
'FontSize' => '30',
|
||||
'FontType' => 'simfang.ttf',
|
||||
'FontColor' => '#99ff00',
|
||||
'Transparency' => '100', // 不透明度
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Type' => 'Text',
|
||||
'LocMode' => 'Absolute',
|
||||
'Dx' => '64',
|
||||
'Dy' => '64',
|
||||
'Pos' => 'TopLeft',
|
||||
'Text' => array(
|
||||
'Text' => '第二个水印',
|
||||
'FontSize' => '30',
|
||||
'FontType' => 'simfang.ttf',
|
||||
'FontColor' => '#99ff00',
|
||||
'Transparency' => '100', // 不透明度
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaTranscodeJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Transcode',
|
||||
'CallBack' => 'https://example.com/callback',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
'FreeTranscode' => 'true', // 闲时转码
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'video01.mkv',
|
||||
),
|
||||
'Transcode' => array(
|
||||
'Container' => array(
|
||||
'Format' => 'mp4'
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'H.264',
|
||||
'Profile' => 'high',
|
||||
'Bitrate' => '1000',
|
||||
'Preset' => 'medium',
|
||||
'Width' => '1280',
|
||||
'Fps' => '30',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '44100',
|
||||
'Bitrate' => '128',
|
||||
'Channels' => '4',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'AdjDarMethod' => 'scale',
|
||||
'IsCheckReso' => 'false',
|
||||
'ResoAdjMethod' => '1',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '0',
|
||||
'Duration' => '60',
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建音视频转码 pro 模板 https://cloud.tencent.com/document/product/460/84732
|
||||
$result = $cosClient->createMediaTranscodeProTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'TranscodePro',
|
||||
'Name' => 'media-transcode-pro-name',
|
||||
'Container' => array(
|
||||
'Format' => 'mxf',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'xavc',
|
||||
'Profile' => 'XAVC-HD_intra_420_10bit_class50',
|
||||
'Width' => '1440',
|
||||
'Height' => '1080',
|
||||
'Interlaced' => 'true',
|
||||
'Fps' => '30000/1001',
|
||||
'Bitrate' => '',
|
||||
'Rotate' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Remove' => '',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'AdjDarMethod' => '',
|
||||
'IsCheckReso' => '',
|
||||
'ResoAdjMethod' => '',
|
||||
'IsCheckVideoBitrate' => '',
|
||||
'VideoBitrateAdjMethod' => '',
|
||||
'IsCheckAudioBitrate' => '',
|
||||
'AudioBitrateAdjMethod' => '',
|
||||
'IsCheckVideoFps' => '',
|
||||
'VideoFpsAdjMethod' => '',
|
||||
'DeleteMetadata' => '',
|
||||
'IsHdr2Sdr' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54037 新增转码模板
|
||||
$result = $cosClient->createMediaTranscodeTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Transcode',
|
||||
'Name' => 'Transcode-Template-Name',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
'ClipConfig' => array(
|
||||
'Duration' => '',
|
||||
),
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Remove' => '',
|
||||
'Profile' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
'Gop' => '',
|
||||
'Preset' => '',
|
||||
'Bufsize' => '',
|
||||
'Maxrate' => '',
|
||||
'Pixfmt' => '',
|
||||
'LongShortMode' => '',
|
||||
'Rotate' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
'Remove' => '',
|
||||
'KeepTwoTracks' => '',
|
||||
'SwitchTrack' => '',
|
||||
'SampleFormat' => '',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'AdjDarMethod' => '',
|
||||
'IsCheckReso' => '',
|
||||
'ResoAdjMethod' => '',
|
||||
'IsCheckVideoBitrate' => '',
|
||||
'VideoBitrateAdjMethod' => '',
|
||||
'IsCheckAudioBitrate' => '',
|
||||
'AudioBitrateAdjMethod' => '',
|
||||
'DeleteMetadata' => '',
|
||||
'IsHdr2Sdr' => '',
|
||||
'HlsEncrypt' => array(
|
||||
'IsHlsEncrypt' => '',
|
||||
'UriKey' => '',
|
||||
),
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'AudioSource' => '',
|
||||
'MixMode' => '',
|
||||
'Replace' => '',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => '',
|
||||
'StartFadeinTime' => '',
|
||||
'EnableEndFadeout' => '',
|
||||
'EndFadeoutTime' => '',
|
||||
'EnableBgmFade' => '',
|
||||
'BgmFadeTime' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/84775
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaVideoEnhanceJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoEnhance',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '', // 画质增强模板 ID
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'tmp/output.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
// 'WatermarkTemplateId' => array(
|
||||
// 'WatermarkTemplateId-1',
|
||||
// 'WatermarkTemplateId-2',
|
||||
// ),
|
||||
// 'Watermark' => array(
|
||||
// array(
|
||||
// 'Type' => '',
|
||||
// 'Pos' => '',
|
||||
// 'LocMode' => '',
|
||||
// 'Dx' => '',
|
||||
// 'Dy' => '',
|
||||
// 'StartTime' => '',
|
||||
// 'EndTime' => '',
|
||||
// 'Image' => array(
|
||||
// 'Url' => '',
|
||||
// 'Mode' => '',
|
||||
// 'Width' => '',
|
||||
// 'Height' => '',
|
||||
// 'Transparency' => '',
|
||||
// 'Background' => '',
|
||||
// ),
|
||||
// 'Text' => array(
|
||||
// 'FontSize' => '',
|
||||
// 'FontType' => '',
|
||||
// 'FontColor' => '',
|
||||
// 'Transparency' => '',
|
||||
// 'Text' => '',
|
||||
// ),
|
||||
// 'SlideConfig' => array(
|
||||
// 'SlideMode' => '',
|
||||
// 'XSlideSpeed' => '',
|
||||
// 'YSlideSpeed' => '',
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// 'DigitalWatermark' => array(
|
||||
// 'Message' => '',
|
||||
// 'Type' => '',
|
||||
// 'Version' => '',
|
||||
// 'IgnoreError' => '',
|
||||
// 'State' => '',
|
||||
// ),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaVideoEnhanceJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoEnhance',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 画质增强参数
|
||||
'VideoEnhance' => array(
|
||||
'Transcode' => array(
|
||||
'Container' => array(
|
||||
'Format' => 'mp4',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'H.264',
|
||||
'Width' => '1280',
|
||||
'Height' => '920',
|
||||
'Fps' => '30',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '44100',
|
||||
'Bitrate' => '128',
|
||||
'Channels' => '4',
|
||||
),
|
||||
),
|
||||
'SuperResolution' => array(
|
||||
'Resolution' => 'sdtohd',
|
||||
'EnableScaleUp' => 'true',
|
||||
'Version' => 'Enhance',
|
||||
),
|
||||
'SDRtoHDR' => array(
|
||||
'HdrMode' => 'HDR10',
|
||||
),
|
||||
'ColorEnhance' => array(
|
||||
'Contrast' => '50',
|
||||
'Correction' => '100',
|
||||
'Saturation' => '100',
|
||||
),
|
||||
'MsSharpen' => array(
|
||||
'SharpenLevel' => '5',
|
||||
),
|
||||
'FrameEnhance' => array(
|
||||
'FrameDoubling' => 'true',
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'tmp/output.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
// 'WatermarkTemplateId' => array(
|
||||
// 'WatermarkTemplateId-1',
|
||||
// 'WatermarkTemplateId-2',
|
||||
// ),
|
||||
// 'Watermark' => array(
|
||||
// array(
|
||||
// 'Type' => '',
|
||||
// 'Pos' => '',
|
||||
// 'LocMode' => '',
|
||||
// 'Dx' => '',
|
||||
// 'Dy' => '',
|
||||
// 'StartTime' => '',
|
||||
// 'EndTime' => '',
|
||||
// 'Image' => array(
|
||||
// 'Url' => '',
|
||||
// 'Mode' => '',
|
||||
// 'Width' => '',
|
||||
// 'Height' => '',
|
||||
// 'Transparency' => '',
|
||||
// 'Background' => '',
|
||||
// ),
|
||||
// 'Text' => array(
|
||||
// 'FontSize' => '',
|
||||
// 'FontType' => '',
|
||||
// 'FontColor' => '',
|
||||
// 'Transparency' => '',
|
||||
// 'Text' => '',
|
||||
// ),
|
||||
// 'SlideConfig' => array(
|
||||
// 'SlideMode' => '',
|
||||
// 'XSlideSpeed' => '',
|
||||
// 'YSlideSpeed' => '',
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// 'DigitalWatermark' => array(
|
||||
// 'Message' => '',
|
||||
// 'Type' => '',
|
||||
// 'Version' => '',
|
||||
// 'IgnoreError' => '',
|
||||
// 'State' => '',
|
||||
// ),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/460/84722 创建画质增强模板
|
||||
$result = $cosClient->createMediaVideoEnhanceTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoEnhance',
|
||||
'Name' => 'TemplateName',
|
||||
'VideoEnhance' => array(
|
||||
'Transcode' => array(
|
||||
'Container' => array(
|
||||
'Format' => 'mp4',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'H.264',
|
||||
'Width' => '1280',
|
||||
'Height' => '920',
|
||||
'Fps' => '30',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '44100',
|
||||
'Bitrate' => '128',
|
||||
'Channels' => '4',
|
||||
),
|
||||
),
|
||||
'SuperResolution' => array(
|
||||
'Resolution' => 'sdtohd',
|
||||
'EnableScaleUp' => 'true',
|
||||
'Version' => 'Enhance',
|
||||
),
|
||||
'SDRtoHDR' => array(
|
||||
'HdrMode' => 'HDR10',
|
||||
),
|
||||
'ColorEnhance' => array(
|
||||
'Contrast' => '50',
|
||||
'Correction' => '100',
|
||||
'Saturation' => '100',
|
||||
),
|
||||
'MsSharpen' => array(
|
||||
'SharpenLevel' => '5',
|
||||
),
|
||||
'FrameEnhance' => array(
|
||||
'FrameDoubling' => 'true',
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58337
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaVideoMontageJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoMontage',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't1fcc3770199e04737axxxxxxxxxxxxxx',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VideoMontage.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaVideoMontageJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoMontage',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'VideoMontage' => array(
|
||||
'Duration' => '',
|
||||
'Scene' => '',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
'Remove' => '',
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/test01.mp3',
|
||||
'MixMode' => 'Once',
|
||||
'Replace' => 'true',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => 'true',
|
||||
'StartFadeinTime' => '3',
|
||||
'EnableEndFadeout' => 'false',
|
||||
'EndFadeoutTime' => '0',
|
||||
'EnableBgmFade' => 'true',
|
||||
'BgmFadeTime' => '1.7',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VideoMontage.mp4',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58314 新增精彩集锦模板
|
||||
$result = $cosClient->createMediaVideoMontageTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoMontage',
|
||||
'Name' => 'VideoMontage-Template-Name',
|
||||
'Duration' => '',
|
||||
'Scene' => '',
|
||||
'Container' => array(
|
||||
'Format' => 'mp4',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => 'H.264',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
'Remove' => '',
|
||||
),
|
||||
'AudioMixArray' => array(
|
||||
array(
|
||||
'AudioSource' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/test01.mp3',
|
||||
'MixMode' => 'Once',
|
||||
'Replace' => 'true',
|
||||
'EffectConfig' => array(
|
||||
'EnableStartFadein' => 'true',
|
||||
'StartFadeinTime' => '3',
|
||||
'EnableEndFadeout' => 'false',
|
||||
'EndFadeoutTime' => '0',
|
||||
'EnableBgmFade' => 'true',
|
||||
'BgmFadeTime' => '1.7',
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/60750
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaVideoProcessJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoProcess',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't13466f1ea41a14c0xxxxxxxxxxxxx', // 视频增强模板 ID
|
||||
'TranscodeTemplateId' => 't0b6a845f5e42847bd81xxxxxxxxxxxxx', // 转码模板 ID
|
||||
'WatermarkTemplateId' => 't185e2e24551b24259a0xxxxxxxxxxxxx', // 水印模板 ID
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VideoProcess.flv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaVideoProcessJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoProcess',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'VideoProcess' => array(
|
||||
'ColorEnhance' => array(
|
||||
'Enable' => '',
|
||||
'Contrast' => '',
|
||||
'Correction' => '',
|
||||
'Saturation' => '',
|
||||
),
|
||||
'MsSharpen' => array(
|
||||
'Enable' => '',
|
||||
'SharpenLevel' => '',
|
||||
),
|
||||
),
|
||||
'Transcode' => array(
|
||||
'Tag' => '',
|
||||
'Name' => '',
|
||||
'Container' => array(
|
||||
'Format' => '',
|
||||
),
|
||||
'Video' => array(
|
||||
'Codec' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Fps' => '',
|
||||
'Remove' => '',
|
||||
'Profile' => '',
|
||||
'Bitrate' => '',
|
||||
'Crf' => '',
|
||||
'Gop' => '',
|
||||
'Preset' => '',
|
||||
'Bufsize' => '',
|
||||
'Maxrate' => '',
|
||||
'HlsTsTime' => '',
|
||||
'Pixfmt' => '',
|
||||
'LongShortMode' => '',
|
||||
),
|
||||
'TimeInterval' => array(
|
||||
'Start' => '',
|
||||
'Duration' => '',
|
||||
),
|
||||
'Audio' => array(
|
||||
'Codec' => '',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
'Remove' => '',
|
||||
'KeepTwoTracks' => '',
|
||||
'SwitchTrack' => '',
|
||||
'SampleFormat' => '',
|
||||
),
|
||||
'TransConfig' => array(
|
||||
'AdjDarMethod' => '',
|
||||
'IsCheckReso' => '',
|
||||
'ResoAdjMethod' => '',
|
||||
'IsCheckVideoBitrate' => '',
|
||||
'VideoBitrateAdjMethod' => '',
|
||||
'IsCheckAudioBitrate' => '',
|
||||
'AudioBitrateAdjMethod' => '',
|
||||
'DeleteMetadata' => '',
|
||||
'IsHdr2Sdr' => '',
|
||||
'HlsEncrypt' => array(
|
||||
'IsHlsEncrypt' => '',
|
||||
'UriKey' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
'Watermark' => array(
|
||||
'Type' => '',
|
||||
'Pos' => '',
|
||||
'LocMode' => '',
|
||||
'Dx' => '',
|
||||
'Dy' => '',
|
||||
'StartTime' => '',
|
||||
'EndTime' => '',
|
||||
'Image' => array(
|
||||
'Url' => '',
|
||||
'Mode' => '',
|
||||
'Width' => '',
|
||||
'Height' => '',
|
||||
'Transparency' => '',
|
||||
'Background' => '',
|
||||
),
|
||||
'Text' => array(
|
||||
'FontSize' => '',
|
||||
'FontType' => '',
|
||||
'FontColor' => '',
|
||||
'Transparency' => '',
|
||||
'Text' => '',
|
||||
),
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VideoProcess.flv',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/60745 新增视频增强模板
|
||||
$result = $cosClient->createMediaVideoProcessTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoProcess',
|
||||
'Name' => 'VideoProcess-Template-Name',
|
||||
'ColorEnhance' => array(
|
||||
'Enable' => '',
|
||||
'Contrast' => '',
|
||||
'Correction' => '',
|
||||
'Saturation' => '',
|
||||
),
|
||||
'MsSharpen' => array(
|
||||
'Enable' => '',
|
||||
'SharpenLevel' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/67202
|
||||
$result = $cosClient->createMediaVideoTagJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoTag',
|
||||
'Input' => array(
|
||||
'Object' => 'video01.mp4'
|
||||
),
|
||||
'Operation' => array(
|
||||
'VideoTag' => array(
|
||||
'Scenario' => 'Stream',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
'CallBack' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58341
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaVoiceSeparateJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VoiceSeparate',
|
||||
'CallBack' => '',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp3'
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VoiceSeparate01.mp3',
|
||||
'AuObject' => 'VoiceSeparate02.mp3',
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaVoiceSeparateJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VoiceSeparate',
|
||||
'CallBack' => '',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp3'
|
||||
),
|
||||
'Operation' => array(
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Object' => 'VoiceSeparate01.mp3',
|
||||
'AuObject' => 'VoiceSeparate02.mp3',
|
||||
),
|
||||
'VoiceSeparate' => array(
|
||||
'AudioMode' => 'AudioAndBackground',
|
||||
'AudioConfig' => array(
|
||||
'Codec' => 'mp3',
|
||||
'Samplerate' => '11025',
|
||||
'Bitrate' => '256',
|
||||
'Channels' => '2',
|
||||
),
|
||||
),
|
||||
// 'UserData' => 'xxx', // 透传用户信息
|
||||
// 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/58315 新增人声分离模板
|
||||
$result = $cosClient->createMediaVoiceSeparateTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VoiceSeparate',
|
||||
'Name' => 'VoiceSeparate-Template-Name',
|
||||
'AudioMode' => 'IsAudio',
|
||||
'AudioConfig' => array(
|
||||
'Codec' => 'aac',
|
||||
'Samplerate' => '',
|
||||
'Bitrate' => '',
|
||||
'Channels' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/54033 新增水印模板
|
||||
// 文本水印
|
||||
$result = $cosClient->createMediaWatermarkTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Watermark',
|
||||
'Name' => 'Watermark-Template-Name',
|
||||
'Watermark' => array(
|
||||
'Type' => 'Text',
|
||||
'Pos' => 'TopRight',
|
||||
'LocMode' => 'Absolute',
|
||||
'Dx' => '128',
|
||||
'Dy' => '128',
|
||||
'StartTime' => '',
|
||||
'EndTime' => '',
|
||||
'Text' => array(
|
||||
'FontSize' => '30',
|
||||
'FontType' => 'simfang',
|
||||
'FontColor' => '0x000000',
|
||||
'Transparency' => '30',
|
||||
'Text' => '水印内容',
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
// 图片水印
|
||||
$result = $cosClient->createMediaWatermarkTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Watermark',
|
||||
'Name' => 'Watermark-Template-Name',
|
||||
'Watermark' => array(
|
||||
'Type' => 'Image',
|
||||
'Pos' => 'TopRight',
|
||||
'LocMode' => 'Absolute',
|
||||
'Dx' => '128',
|
||||
'Dy' => '128',
|
||||
'StartTime' => '',
|
||||
'EndTime' => '',
|
||||
'Image' => array(
|
||||
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/test01.png',
|
||||
'Mode' => 'Proportion',
|
||||
'Width' => '10',
|
||||
'Height' => '',
|
||||
'Transparency' => '100',
|
||||
'Background' => '',
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->createMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
/*
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'string',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'StorageClass' => 'string'
|
||||
*/
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交一个语音识别任务 https://cloud.tencent.com/document/product/460/84798
|
||||
// 1. 使用模版
|
||||
$result = $cosClient->createVoiceSpeechRecognitionJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SpeechRecognition',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp3',
|
||||
// 'Url' => '',
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '',
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'xxx.txt',
|
||||
),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
// 2. 自定义参数
|
||||
$result = $cosClient->createVoiceSpeechRecognitionJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SpeechRecognition',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp3',
|
||||
// 'Url' => '',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
'SpeechRecognition' => array(
|
||||
'EngineModelType' => '16k_zh',
|
||||
'ChannelNum' => 1,
|
||||
'ResTextFormat' => 1,
|
||||
'FilterDirty' => 0,
|
||||
'FilterModal' => 1,
|
||||
'ConvertNumMode' => 0,
|
||||
'SpeakerDiarization' => 1,
|
||||
'SpeakerNumber' => 0,
|
||||
'FilterPunc' => 0,
|
||||
// 'OutputFileType' => 'txt',
|
||||
// 'FlashAsr' => 'true',
|
||||
// 'Format' => 'mp3',
|
||||
// 'FirstChannelOnly' => 1,
|
||||
// 'WordInfo' => 1,
|
||||
// 'SentenceMaxLength' => 6,
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'xxx.txt',
|
||||
),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建语音识别模板 https://cloud.tencent.com/document/product/460/84498
|
||||
$result = $cosClient->createVoiceSpeechRecognitionTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SpeechRecognition',
|
||||
'Name' => 'voice-speechrecognition-name',
|
||||
'SpeechRecognition' => array(
|
||||
'EngineModelType' => '16k_zh',
|
||||
'ChannelNum' => 1,
|
||||
'ResTextFormat' => 1,
|
||||
'FilterDirty' => 0,
|
||||
'FilterModal' => 1,
|
||||
'ConvertNumMode' => 0,
|
||||
'SpeakerDiarization' => 1,
|
||||
'SpeakerNumber' => 0,
|
||||
'FilterPunc' => 0,
|
||||
'OutputFileType' => 'txt',
|
||||
// 'FlashAsr' => 'true',
|
||||
// 'Format' => 'mp3',
|
||||
// 'FirstChannelOnly' => 1,
|
||||
// 'WordInfo' => 1,
|
||||
// 'SentenceMaxLength' => 6,
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交一个语音合成任务 https://cloud.tencent.com/document/product/460/84797
|
||||
// 1. 使用模版
|
||||
$result = $cosClient->createVoiceTtsJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Tts', // 固定为 Tts
|
||||
'Operation' => array(
|
||||
'TemplateId' => 't1460606b9752148c4ab182f55163ba7cd',
|
||||
'TtsConfig' => array(
|
||||
'InputType' => 'Text',
|
||||
'Input' => '床前明月光,疑是地上霜',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'demo.mp3',
|
||||
),
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
// 2. 自定义参数
|
||||
$result = $cosClient->createVoiceTtsJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Tts', // 固定为 Tts
|
||||
'Operation' => array(
|
||||
'TtsConfig' => array(
|
||||
'InputType' => 'Text',
|
||||
'Input' => '床前明月光,疑是地上霜',
|
||||
),
|
||||
'TtsTpl' => array(
|
||||
'Mode' => 'Sync',
|
||||
'Codec' => 'pcm',
|
||||
'VoiceType' => 'aixiaoxing',
|
||||
'Volume' => '2',
|
||||
'Speed' => '200',
|
||||
'Emotion' => 'arousal',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'demo.mp3',
|
||||
),
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 万象接口必须使用https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建语音合成模板 https://cloud.tencent.com/document/product/460/84499
|
||||
$result = $cosClient->createVoiceTtsTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Tts',
|
||||
'Name' => 'TemplateName',
|
||||
'Mode' => 'Sync',
|
||||
'Codec' => 'pcm',
|
||||
'VoiceType' => 'aixiaoxing',
|
||||
'Volume' => '2',
|
||||
'Speed' => '200',
|
||||
'Emotion' => 'arousal',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucket(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucketCors(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucketDomain(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->DeleteBucketGuetzli(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->DeleteBucketImageStyle(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'StyleName' => 'stylename',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucketLifecycle(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucketTagging(array(
|
||||
'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteBucketWebsite(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
//列出所有buckets
|
||||
$buckets = $cosClient->listBuckets();
|
||||
|
||||
//若bucket列表不为空则进行删除逻辑,先删除对象,再判断是否有上传的任务进行删除,最后删除桶
|
||||
if (!empty($buckets['Buckets'][0])) {
|
||||
foreach ($buckets['Buckets'][0]['Bucket'] as $key => $value) {
|
||||
$result = $cosClient->listObjects(array('Bucket' => $value['Name']));
|
||||
if (isset($result['Contents'])) {
|
||||
foreach ($result['Contents'] as $content) {
|
||||
$cosClient->deleteObject(array('Bucket' => $value['Name'], 'Key' => $content['Key']));
|
||||
}
|
||||
}
|
||||
while(True){
|
||||
$result = $cosClient->ListMultipartUploads(
|
||||
array('Bucket' => $value['Name']));
|
||||
if ($result['Uploads'] == array()) {
|
||||
break;
|
||||
}
|
||||
foreach ($result['Uploads'] as $upload) {
|
||||
try {
|
||||
$cosClient->AbortMultipartUpload(
|
||||
array('Bucket' => $value['Name'],
|
||||
'Key' => $upload['Key'],
|
||||
'UploadId' => $upload['UploadId']));
|
||||
} catch (\Exception $e) {
|
||||
print_r($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
$cosClient->deleteBucket(array('Bucket' => $value['Name']));
|
||||
}
|
||||
}
|
||||
print_r('DELETE ALL BUCKETS SUCCEED!');
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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)));
|
||||
|
||||
$cos_path = "cos/folder";
|
||||
$nextMarker = '';
|
||||
$isTruncated = true;
|
||||
while ( $isTruncated ) {
|
||||
try {
|
||||
$result = $cosClient->listObjects(
|
||||
['Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Delimiter' => '',
|
||||
'EncodingType' => 'url',
|
||||
'Marker' => $nextMarker,
|
||||
'Prefix' => $cos_path,
|
||||
'MaxKeys' => 1000]
|
||||
);
|
||||
$isTruncated = $result['IsTruncated'];
|
||||
$nextMarker = $result['NextMarker'];
|
||||
foreach ( $result['Contents'] as $content ) {
|
||||
$cos_file_path = $content['Key'];
|
||||
$local_file_path = $content['Key'];
|
||||
// 按照需求自定义拼接下载路径
|
||||
try {
|
||||
$cosClient->deleteObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => $cos_file_path,
|
||||
));
|
||||
echo ( $cos_file_path . "\n" );
|
||||
} catch ( \Exception $e ) {
|
||||
echo( $e );
|
||||
}
|
||||
}
|
||||
} catch ( \Exception $e ) {
|
||||
echo( $e );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->deleteObjectTagging(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/53990 删除工作流
|
||||
$result = $cosClient->deleteWorkflow(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // WorkflowId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/71517 查询存量任务
|
||||
$result = $cosClient->describeInventoryTriggerJob(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // jobId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/71518 批量拉取存量任务
|
||||
$result = $cosClient->describeInventoryTriggerJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
// 'NextToken' => '',
|
||||
// 'Size' => '',
|
||||
// 'OrderByTime' => '',
|
||||
// 'States' => '',
|
||||
// 'StartCreationTime' => '',
|
||||
// 'EndCreationTime' => '',
|
||||
// 'WorkflowId' => '',
|
||||
// 'JobId' => '',
|
||||
// 'Name' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
// 查询指定的任务
|
||||
$result = $cosClient->describeMediaJob(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // jobId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
/*
|
||||
拉取符合条件的任务, 支持
|
||||
Transcode、Snapshot、Animation、Concat、SmartCover、VideoProcess、VideoMontage、VoiceSeparate、SDRtoHDR、
|
||||
DigitalWatermark、ExtractDigitalWatermark、SuperResolution、VideoTag、PicProcess、Segment
|
||||
*/
|
||||
$result = $cosClient->describeMediaJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'Transcode', // 任务 的Tag
|
||||
'QueueId' => 'paaf4fce5521a40888a3034a5dxxxxxxx', // queueId
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
// 查询模版列表
|
||||
$result = $cosClient->describeMediaTemplates(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => '', // 模板 Tag:Animation、Snapshot、Watermark、Transcode、Concat、HighSpeedHd、VideoMontage、VoiceSeparate、VideoProcess、PicProcess
|
||||
'Category' => 'Custom',
|
||||
'Ids' => '',
|
||||
'Name' => '',
|
||||
'PageNumber' => '',
|
||||
'PageSize' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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/53991 搜索工作流
|
||||
$result = $cosClient->describeWorkflow(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
// 'Ids' => '',
|
||||
// 'Name' => '',
|
||||
// 'PageNumber' => '',
|
||||
// 'PageSize' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// start --------------- 桶文件审核 ----------------- //
|
||||
$result = $cosClient->detectAudio(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Object' => 'sound01.mp3',
|
||||
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ),
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '', // 可选 定制化策略
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数,BizType为空时走默认策略,BizType不为空走定制化策略
|
||||
// 'Callback' => '', // 可选 回调URL
|
||||
// 'CallbackVersion' => '', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。
|
||||
// 'Freeze' => array(
|
||||
// 'PornScore' => 90,
|
||||
// 'AdsScore' => 90,
|
||||
// 'PoliticsScore' => 90,
|
||||
// 'TerrorismScore' => 90,
|
||||
// ), // 可选 可通过该字段,设置根据审核结果给出的不同分值,对音频文件进行自动冻结,仅当`input`中审核的音频为`object`时有效
|
||||
// ), // 可选 走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 桶文件审核 ----------------- //
|
||||
|
||||
// start --------------- 音频文件地址审核 ----------------- //
|
||||
$result = $cosClient->detectAudio(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => 'https://example.com/test.mp3',
|
||||
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '', // 可选 定制化策略
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数,BizType为空时走默认策略,BizType不为空走定制化策略
|
||||
// 'Callback' => '', // 可选 回调URL
|
||||
// 'CallbackVersion' => '', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。
|
||||
// ), // 可选 走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 音频文件地址审核 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 存储桶文档审核
|
||||
$result = $cosClient->detectDocument(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Object' => 'test01.docx',
|
||||
// 'Type' => 'docx',
|
||||
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ),
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '',
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景
|
||||
// 'Callback' => '', // 回调URL 选填
|
||||
// 'Freeze' => array(
|
||||
// 'PornScore' => 90,
|
||||
// 'AdsScore' => 90,
|
||||
// 'PoliticsScore' => 90,
|
||||
// 'TerrorismScore' => 90,
|
||||
// ), // 选填 可通过该字段,设置根据审核结果给出的不同分值,对文档进行自动冻结。仅当`input`中审核的文档为`object`时有效。
|
||||
// ), // 选填 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
// 文档URL审核
|
||||
$result = $cosClient->detectDocument(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => 'https://example.com/test01.docx',
|
||||
// 'Type' => 'docx',
|
||||
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '',
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景
|
||||
// 'Callback' => '', // 回调URL 选填
|
||||
// ), // 选填 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//存储桶图片审核
|
||||
$result = $cosClient->detectImage(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.png', // 桶文件
|
||||
'ci-process' => 'sensitive-content-recognition',
|
||||
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
|
||||
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
|
||||
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。
|
||||
// 'LargeImageDetect' => '',
|
||||
// 'DataId' => '',
|
||||
// 'Async' => '',
|
||||
// 'Callback' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
|
||||
//图片链接审核
|
||||
$imgUrl = 'https://test.jpg';
|
||||
$result = $cosClient->detectImage(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '/', // 链接图片资源路径写 / 即可
|
||||
'ci-process' => 'sensitive-content-recognition',
|
||||
'DetectUrl' => $imgUrl,
|
||||
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
|
||||
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
|
||||
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。
|
||||
// 'LargeImageDetect' => '',
|
||||
// 'DataId' => '',
|
||||
// 'Async' => '',
|
||||
// 'Callback' => '',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 获取图片base64编码
|
||||
// $localImageFile = '/tmp/test.jpg';
|
||||
// $img = file_get_contents($localImageFile);
|
||||
// $imgInfo = getimagesize($localImageFile);
|
||||
// $imgBase64Content = base64_encode($img);
|
||||
|
||||
$result = $cosClient->detectImages(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Inputs' => array(
|
||||
array(
|
||||
'Object' => 'test01.png', // 桶文件
|
||||
// 'Interval' => '', // 可选 审核 GIF 时使用 截帧的间隔
|
||||
// 'MaxFrames' => '', // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。
|
||||
// 'DataId' => 'aaa', // 可选 图片标识,该字段在结果中返回原始内容,长度限制为512字节
|
||||
// 'LargeImageDetect' => 1, // 对于超过大小限制的图片是否进行压缩后再审核,取值为: 0(不压缩),1(压缩)。默认为0。注:压缩最大支持32M的图片,且会收取压缩费用
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ), // 可选 用户业务字段
|
||||
// 'Encryption' => array(
|
||||
// 'Algorithm' => '',
|
||||
// 'Key' => '',
|
||||
// 'IV' => '',
|
||||
// 'KeyId' => '',
|
||||
// 'KeyType' => 0,
|
||||
// ), // 可选 文件加密信息。如果图片未做加密则不需要使用该字段,如果设置了该字段,则会按设置的信息解密后再做审核。
|
||||
),
|
||||
array(
|
||||
'Url' => 'http://example.com/test.png', // 图片URL
|
||||
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
|
||||
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。
|
||||
// 'DataId' => 'bbb', // 可选 图片标识,该字段在结果中返回原始内容,长度限制为512字节
|
||||
// 'LargeImageDetect' => 1, // 对于超过大小限制的图片是否进行压缩后再审核,取值为: 0(不压缩),1(压缩)。默认为0。注:压缩最大支持32M的图片,且会收取压缩费用
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ), // 可选 用户业务字段
|
||||
// 'Encryption' => array(
|
||||
// 'Algorithm' => '',
|
||||
// 'Key' => '',
|
||||
// 'IV' => '',
|
||||
// 'KeyId' => '',
|
||||
// 'KeyType' => 0,
|
||||
// ), // 可选 文件加密信息。如果图片未做加密则不需要使用该字段,如果设置了该字段,则会按设置的信息解密后再做审核。
|
||||
),
|
||||
// array(
|
||||
// 'Content' => $imgBase64Content, // 图片文件的内容,需要先经过 base64 编码。注:Content方式提交图片不支持文件加密方式
|
||||
//// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
|
||||
//// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。
|
||||
//// 'DataId' => 'ccc', // 可选 图片标识,该字段在结果中返回原始内容,长度限制为512字节
|
||||
// ),
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
|
||||
// 'Async' => 0, // 可选 是否异步进行审核,0:同步返回结果,1:异步进行审核。默认值为 0。
|
||||
// 'Callback' => '', // 可选 审核结果(Detail版本)以回调形式发送至您的回调地址
|
||||
// 'Freeze' => array(
|
||||
// 'PornScore' => 90,
|
||||
// 'AdsScore' => 90,
|
||||
// 'PoliticsScore' => 90,
|
||||
// 'TerrorismScore' => 90,
|
||||
// ), // 可选 可通过该字段,设置根据审核结果给出的不同分值,对图片进行自动冻结,仅当`input`中审核的图片为`object`时有效。
|
||||
// ) // 可选 BizType 不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->DetectLabel(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->detectLiveVideo(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Type' => 'live_video',
|
||||
'Input' => array(
|
||||
'Url' => 'rtmp://example.com/live/123', // 直播流地址
|
||||
// 'DataId' => '',
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// ),
|
||||
),
|
||||
'Conf' => array(
|
||||
'Callback' => '',
|
||||
// 'CallbackType' => 1,
|
||||
'BizType' => '07d41bbb5a3a93dca4xxxxxxxxxxx', // 直播流审核 BizType 必填,可联系工作人员生成后使用
|
||||
),
|
||||
'StorageConf' => array(
|
||||
'Path' => 'xxx',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// start --------------- 文本内容审核 ----------------- //
|
||||
$content = '敏感词';
|
||||
$result = $cosClient->detectText(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Content' => base64_encode($content), // 文本需base64_encode
|
||||
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads,Illegal,Abuse', // 选填,在只有BizType时走设定策略的审核场景
|
||||
// 'BizType' => '',
|
||||
// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 文本内容审核 ----------------- //
|
||||
|
||||
// start --------------- 存储桶文本文件审核 ----------------- //
|
||||
$result = $cosClient->detectText(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Object' => 'test01.txt'
|
||||
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '',
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景
|
||||
// 'Callback' => '', // 回调URL 选填
|
||||
// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple
|
||||
// 'Freeze' => array(
|
||||
// 'PornScore' => 90,
|
||||
// 'AdsScore' => 90,
|
||||
// 'IllegalScore' => 90,
|
||||
// 'AbuseScore' => 90,
|
||||
// 'PoliticsScore' => 90,
|
||||
// 'TerrorismScore' => 90,
|
||||
// ),
|
||||
// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 存储桶文本文件审核 ----------------- //
|
||||
|
||||
// start --------------- 文本文件Url审核 ----------------- //
|
||||
$result = $cosClient->detectText(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => 'http://example.com/test.txt'
|
||||
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => '',
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景
|
||||
// 'Callback' => '', // 选填 回调URL
|
||||
// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple
|
||||
// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 文本文件Url审核 ----------------- //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//存储桶视频审核
|
||||
$result = $cosClient->detectVideo(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4', // 存储桶文件
|
||||
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ),
|
||||
// 'Encryption' => array(
|
||||
// 'Algorithm' => '',
|
||||
// 'Key' => '',
|
||||
// 'IV' => '',
|
||||
// 'KeyId' => '',
|
||||
// 'KeyType' => 0,
|
||||
// ),
|
||||
),
|
||||
'Conf' => array(
|
||||
// 'BizType' => '', // 可选 定制化策略
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略
|
||||
// 'Callback' => '', // 可选 回调URL
|
||||
// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音,当值为0时:表示只审核视频画面截图;值为1时:表示同时审核视频画面截图和视频声音。默认值为0。
|
||||
// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。
|
||||
'Snapshot' => array(
|
||||
// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式;Average 表示平均模式;Fps 表示固定帧率模式。
|
||||
// 'TimeInterval' => 50, // 可选 视频截帧频率
|
||||
'Count' => '3', // 视频截帧数量
|
||||
),
|
||||
// 'Freeze' => array(
|
||||
// 'PornScore' => 90,
|
||||
// 'AdsScore' => 90,
|
||||
// 'PoliticsScore' => 90,
|
||||
// 'TerrorismScore' => 90,
|
||||
// ), // 可选 自动冻结配置项,可配置指定审核分数的结果进行自动冻结
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
|
||||
//视频url审核
|
||||
$videoUrl = 'http://example.com/test.mp4';
|
||||
$result = $cosClient->detectVideo(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => $videoUrl, // 视频url
|
||||
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
),
|
||||
'Conf' => array(
|
||||
// 'BizType' => '', // 可选 定制化策略
|
||||
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略
|
||||
// 'Callback' => '', // 可选 回调URL
|
||||
// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音,当值为0时:表示只审核视频画面截图;值为1时:表示同时审核视频画面截图和视频声音。默认值为0。
|
||||
// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。
|
||||
'Snapshot' => array(
|
||||
// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式;Average 表示平均模式;Fps 表示固定帧率模式。
|
||||
// 'TimeInterval' => 50, // 可选 视频截帧频率
|
||||
'Count' => '3', // 视频截帧数量
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 存储桶文件查毒
|
||||
$result = $cosClient->detectVirus(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Object' => 'test01.exe'
|
||||
),
|
||||
'Conf' => array(
|
||||
'DetectType' => 'Virus',
|
||||
// 'Callback' => '',
|
||||
),
|
||||
));
|
||||
|
||||
// URL查毒
|
||||
$result = $cosClient->detectVirus(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => 'https://example.com/test01.exe',
|
||||
),
|
||||
'Conf' => array(
|
||||
'DetectType' => 'Virus',
|
||||
// 'Callback' => '',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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', // 审核时必须为https
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->detectWebpage(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Input' => array(
|
||||
'Url' => 'https://www.xxx.com/',
|
||||
// 'DataId' => 'xxx', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
|
||||
// 'UserInfo' => array(
|
||||
// 'TokenId' => '',
|
||||
// 'Nickname' => '',
|
||||
// 'DeviceId' => '',
|
||||
// 'AppId' => '',
|
||||
// 'Room' => '',
|
||||
// 'IP' => '',
|
||||
// 'Type' => '',
|
||||
// 'ReceiveTokenId' => '',
|
||||
// 'Gender' => '',
|
||||
// 'Level' => '',
|
||||
// 'Role' => '',
|
||||
// ), // 可选 用户业务字段
|
||||
),
|
||||
// 'Conf' => array(
|
||||
// 'BizType' => 'd7a51676a0xxxxxxxxxxxxxxxxxxxxxx', // 可选 审核策略
|
||||
//// 'DetectType' => 'Porn', // 可选 审核的场景类型 注:该参数后续不再维护,请使用BizType参数
|
||||
// 'Callback' => 'http://xxx.com/xxx', // 可选 回调地址,以http://或者https://开头的地址。
|
||||
// 'ReturnHighlightHtml' => 'true', // 可选 true 或者 false 指定是否需要高亮展示网页内的违规文本,查询及回调结果时会根据此参数决定是否返回高亮展示的 html 内容
|
||||
// 'CallbackType' => 1, // 可选 回调片段类型,有效值:1(回调全部图片和文本片段)、2(回调违规图片和文本片段)。默认为 1。
|
||||
// ), // 审核规则配置
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
// 1. 文档转码 https://cloud.tencent.com/document/product/460/47074
|
||||
$bucket = 'examplebucket-125000000';
|
||||
$key = 'exampleobject';
|
||||
$url = $cosClient->getObjectUrl($bucket, $key);
|
||||
$params = array(
|
||||
'ci-process' => 'doc-preview',
|
||||
// 'srcType' => '',
|
||||
'page' => 3,
|
||||
'dstType' => 'png',
|
||||
// 'password' => '',
|
||||
// 'comment' => '',
|
||||
// 'sheet' => '',
|
||||
// 'excelPaperDirection' => '',
|
||||
// 'excelRow' => '',
|
||||
// 'excelCol' => '',
|
||||
// 'excelPaperSize' => '',
|
||||
// 'txtPagination' => '',
|
||||
'ImageParams' => 'imageMogr2/thumbnail/!50p',
|
||||
// 'quality' => '',
|
||||
// 'scale' => '',
|
||||
// 'imageDpi' => '',
|
||||
);
|
||||
$query = http_build_query($params);
|
||||
echo $url . $query; // 生成的可访问链接
|
||||
|
||||
// 2. 文档转HTML https://cloud.tencent.com/document/product/460/52518
|
||||
$bucket = 'examplebucket-125000000';
|
||||
$key = 'exampleobject';
|
||||
$url = $cosClient->getObjectUrl($bucket, $key, "+30 minutes");
|
||||
$params = array(
|
||||
'ci-process' => 'doc-preview',
|
||||
// 'srcType' => '',
|
||||
'dstType' => 'html',
|
||||
// 'sign' => '',
|
||||
// 'copyable' => '',
|
||||
// 'htmlParams' => '',
|
||||
// 'htmlwaterword' => '',
|
||||
// 'htmlfillstyle' => '',
|
||||
// 'htmlfront' => '',
|
||||
// 'htmlrotate' => '',
|
||||
// 'htmlhorizontal' => '',
|
||||
// 'htmlvertical' => '',
|
||||
);
|
||||
$query = http_build_query($params);
|
||||
echo $url . $query; // 生成的可访问链接
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->doesBucketExist(
|
||||
'examplebucket-125000000'//存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
); ;
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__, 2) . '/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 {
|
||||
$result = $cosClient->doesObjectExist(
|
||||
'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'exampleobject' //对象名
|
||||
);
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user