初始化项目
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
name: format
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format Code
|
||||
runs-on: "${{ matrix.os }}"
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php-version: ['8.0']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: none
|
||||
|
||||
- name: Setup Dependencies
|
||||
run:
|
||||
composer install -o
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
php bin/format
|
||||
php bin/release
|
||||
|
||||
- name: Commit Updated
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Format code
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Support Multiple Versions
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
install:
|
||||
name: PHP${{ matrix.php-version }} Test Install
|
||||
runs-on: "${{ matrix.os }}"
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
max-parallel: 10
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: none
|
||||
|
||||
- name: Setup Dependencies
|
||||
run:
|
||||
composer install -o
|
||||
+474
@@ -0,0 +1,474 @@
|
||||
cos-php-sdk-v5 Upgrade Guide
|
||||
====================
|
||||
2.6.12 to 2.6.13
|
||||
---------
|
||||
修复部分问题
|
||||
|
||||
2.6.11 to 2.6.12
|
||||
---------
|
||||
1. 盲水印支持版本参数
|
||||
2. 更新sts-sdk demo
|
||||
3. 压缩包预览
|
||||
4. hls加密
|
||||
5. 视频明水印
|
||||
6. 图片水印支持spacing参数
|
||||
|
||||
2.6.10 to 2.6.11
|
||||
---------
|
||||
1. 创建数据集
|
||||
2. 查询数据集
|
||||
3. 列出数据集
|
||||
4. 更新数据集
|
||||
5. 删除数据集
|
||||
6. 绑定存储桶与数据集
|
||||
7. 解绑存储桶与数据集
|
||||
8. 查询数据集与存储桶的绑定关系
|
||||
9. 查询绑定关系列表
|
||||
10. 更新元数据索引
|
||||
11. 删除元数据索引
|
||||
12. 创建元数据索引
|
||||
13. 查询元数据索引
|
||||
14. 人脸搜索
|
||||
15. 简单查询
|
||||
16. 图像检索
|
||||
|
||||
2.6.9 to 2.6.10
|
||||
---------
|
||||
1. 安全特性
|
||||
|
||||
2.6.8 to 2.6.9
|
||||
---------
|
||||
1. 开通智能语音服务
|
||||
2. 查询智能语音服务
|
||||
3. 关闭智能语音服务
|
||||
4. 更新智能语音队列
|
||||
5. 查询智能语音队列
|
||||
6. 创建音频降噪模板
|
||||
7. 更新音频降噪模板
|
||||
8. 提交听歌识曲任务
|
||||
9. 提交音乐评分任务
|
||||
|
||||
2.6.7 to 2.6.8
|
||||
---------
|
||||
1. 实时文字翻译
|
||||
2. 图片标签
|
||||
3. Logo、游戏场景、人体、宠物、卡证识别
|
||||
4. 创建、更新视频目标检测模板
|
||||
5. 提交视频目标检测任务、视频人像抠图任务
|
||||
6. 关闭AI内容识别服务
|
||||
|
||||
2.6.6 to 2.6.7
|
||||
---------
|
||||
修复部分问题
|
||||
|
||||
2.6.5 to 2.6.6
|
||||
---------
|
||||
修复部分问题
|
||||
|
||||
2.6.4 to 2.6.5
|
||||
---------
|
||||
1. 文字水印支持scatype、spcent参数
|
||||
2. 支持提交画质增强任务
|
||||
3. 创建/更新画质增强模板
|
||||
|
||||
2.6.3 to 2.6.4
|
||||
---------
|
||||
1. 媒体处理转码任务支持闲时转码
|
||||
2. 搜索图片处理队列
|
||||
3. 更新图片处理队列
|
||||
4. 查询图片处理服务状态
|
||||
5. 查询 AI 内容识别服务状态
|
||||
6. 开通 AI 内容识别
|
||||
7. 搜索 AI 内容识别队列
|
||||
8. 更新 AI 内容识别队列
|
||||
9. 创建音视频转码 pro 模板
|
||||
10. 更新音视频转码 pro 模板
|
||||
11. 创建语音合成模板
|
||||
12. 更新语音合成模板
|
||||
13. 创建智能封面模板
|
||||
14. 更新智能封面模板
|
||||
15. 创建语音识别模板
|
||||
16. 更新语音识别模板
|
||||
17. 提交一个语音合成任务
|
||||
18. 提交一个翻译任务
|
||||
19. 提交一个语音识别任务
|
||||
20. 提交一个分词任务
|
||||
|
||||
2.6.2 to 2.6.3
|
||||
---------
|
||||
1. 直播审核支持转存到cos存储桶
|
||||
2. 网页审核支持BizType参数
|
||||
3. 批量图片审核接口支持加密图片审核
|
||||
4. 支持加密视频审核
|
||||
5. 桶文件审核时支持冻结操作
|
||||
6. 媒体处理、文档预览、文档审核队列ID允许为空
|
||||
|
||||
2.6.1 to 2.6.2
|
||||
---------
|
||||
修复部分问题
|
||||
|
||||
2.6.0 to 2.6.1
|
||||
---------
|
||||
1. 多文件打包压缩
|
||||
2. 文件哈希值计算
|
||||
3. 文件解压
|
||||
|
||||
2.5.6 to 2.6.0
|
||||
---------
|
||||
1. 通用文字识别接口
|
||||
2. 取消存量任务
|
||||
3. 触发批量存量任务
|
||||
4. 新增动图模板
|
||||
5. 新增拼接模板
|
||||
6. 新增极速高清转码模板
|
||||
7. 新增图片处理模板
|
||||
8. 新增截图模板
|
||||
9. 新增超分辨率模板
|
||||
10. 新增转码模板
|
||||
11. 新增精彩集锦模板
|
||||
12. 新增视频增强模板
|
||||
13. 新增人声分离模板
|
||||
14. 新增水印模板
|
||||
15. 删除工作流
|
||||
16. 查询存量任务
|
||||
17. 批量拉取存量任务
|
||||
18. 查询模版列表
|
||||
19. 搜索工作流
|
||||
20. 获取工作流实例详情
|
||||
21. 获取工作流实例列表
|
||||
22. 手动触发工作流
|
||||
23. 更新动图模板
|
||||
24. 更新拼接模板
|
||||
25. 更新极速高清转码模板
|
||||
26. 更新图片处理模板
|
||||
27. 更新截图模板
|
||||
28. 更新超分辨率模板
|
||||
29. 更新转码模板
|
||||
30. 更新精彩集锦模板
|
||||
31. 更新视频增强模板
|
||||
32. 更新人声分离模板
|
||||
33. 更新水印模板
|
||||
34. 提交音频降噪任务
|
||||
35. 图片水印修复
|
||||
36. 图片处理参数使用demo
|
||||
37. 开通以图搜图
|
||||
38. 添加图库图片
|
||||
39. 图片搜索接口
|
||||
40. 删除图库图片
|
||||
41. 绑定数据万象服务
|
||||
42. 查询数据万象服务
|
||||
43. 解绑数据万象服务
|
||||
44. 查询防盗链
|
||||
45. 设置防盗链
|
||||
46. 开通原图保护
|
||||
47. 查询原图保护状态
|
||||
48. 关闭原图保护
|
||||
49. 人脸检测
|
||||
50. 人脸特效
|
||||
51. 身份证识别
|
||||
52. 身份证识别-上传时处理
|
||||
53. 获取数字验证码
|
||||
54. 获取动作顺序
|
||||
55. 查询文档预览开通状态
|
||||
56. 更新文档转码队列
|
||||
57. 图片审核新增异步审核参数Async,新增部分审核结果参数
|
||||
58. 媒体处理任务接口新增UserData、JobLevel、CallBackFormat、CallBackType、CallBackMqConfig参数
|
||||
59. 图片批量审核新增Content参数,可以提交经过base64编码的图片文件内容进行审核
|
||||
60. 提交视频质量评分任务
|
||||
61. 提交音视频流分离任务
|
||||
2.5.5 to 2.5.6
|
||||
---------
|
||||
- 创建SDRtoHDR任务
|
||||
- 创建添加数字水印任务
|
||||
- 创建提取数字水印任务
|
||||
- 创建超分任务
|
||||
- 创建视频标签
|
||||
- 创建图片处理任务
|
||||
- 创建转封装任务
|
||||
- 审核各接口参数修改
|
||||
- 直播流审核接口
|
||||
- 取消直播流审核接口
|
||||
- 修复全球加速region不存在的问题
|
||||
|
||||
2.5.4 to 2.5.5
|
||||
---------
|
||||
- fix signHost type error
|
||||
|
||||
2.5.3 to 2.5.4
|
||||
---------
|
||||
- 新增查询是否开通媒体处理接口
|
||||
- 新增获取pm3u8签名接口
|
||||
- 新增查询队列列表接口
|
||||
- 新增更新队列接口
|
||||
- 新增查询任务接口
|
||||
- 新增创建多任务接口
|
||||
- 新增创建截图任务接口
|
||||
- 新增创建转码任务接口
|
||||
- 新增创建动图任务接口
|
||||
- 新增创建拼接任务接口
|
||||
- 新增创建智能封面任务接口
|
||||
- 新增创建视频增强任务接口
|
||||
- 新增创建精彩集锦任务接口
|
||||
- 新增创建人声分离任务接口
|
||||
- 修复signHost值获取不到的问题
|
||||
|
||||
2.5.2 to 2.5.3
|
||||
---------
|
||||
- 增加ETag的兼容逻辑,防止因为特殊框架或者网关规则导致etag undefined
|
||||
|
||||
2.5.1 to 2.5.2
|
||||
---------
|
||||
- 修复预签名中Headers参数无效的问题
|
||||
|
||||
2.5.0 to 2.5.1
|
||||
---------
|
||||
- 万象相关接口的DetectType审核类型参数可选
|
||||
- 万象内容审核接口增加DataId自定义业务标识
|
||||
- 新增万象网页审核任务相关接口
|
||||
- 新增部分参数校验
|
||||
- 修复PHP8.1中将null传递给不可为空的内部函数的问题
|
||||
|
||||
2.4.4 to 2.5.0
|
||||
---------
|
||||
- 万象支持病毒检测、人声分离任务接口
|
||||
- 万象转码任务支持多个水印参数/多任务接口/查询接口/列表接口
|
||||
- 修复签名长期存在的bug
|
||||
- 修复copy接口404问题,copyObject示例添加注释
|
||||
- 审核接口增加仅支持https的说明
|
||||
|
||||
2.4.3 to 2.4.4
|
||||
---------
|
||||
- 修复图片水印签名问题
|
||||
|
||||
2.4.2 to 2.4.3
|
||||
---------
|
||||
- 优化审核接口返回相关字段
|
||||
- 增加host开关功能
|
||||
- GetObject接口支持万象自定义样式
|
||||
- 修复ip的host bug
|
||||
|
||||
2.4.1 to 2.4.2
|
||||
---------
|
||||
- 修复图片处理相关接口403签名不对的bug
|
||||
|
||||
2.4.0 to 2.4.1
|
||||
---------
|
||||
- 增加桶Bucket、GetBucket对应Sample详细注解
|
||||
- 对部分传入参数进行检查
|
||||
- 添加doesObjectExist、doesBucketExist对应Sample
|
||||
- 调整整体项目架构,修复composer依赖问题
|
||||
- 调整UT
|
||||
|
||||
2.3.4 to 2.4.0
|
||||
---------
|
||||
- 新增文档转码功能,包括提交、查询、拉取文档预览任务
|
||||
- 丰富头域参数说明
|
||||
- 修复预签名中将万象参数作为key报错问题
|
||||
- 调整travis与action,后续版本保证多版本测试正常
|
||||
|
||||
2.3.3 to 2.3.4
|
||||
---------
|
||||
- 修复laravel8中guzzlehttp/psr7报错问题,后续重新整理依赖
|
||||
- 修复putBucketAccelerate接口与目前API不一致的问题
|
||||
|
||||
2.3.2 to 2.3.3
|
||||
---------
|
||||
- 修复laravel8中guzzlehttp/psr7报错问题
|
||||
- 清理无用代码
|
||||
|
||||
2.3.1 to 2.3.2
|
||||
---------
|
||||
- 新增视频截帧,视频信息查询示例
|
||||
- 新增PUT/GET Bucket Referer示例
|
||||
- 对于相应接口添加CRC返回信息
|
||||
- 修复图片审核中ci-process param出现两次的问题
|
||||
- 修复PHP5.6 版本的依赖问题
|
||||
- 根据PHP版本自动composer install guzzle6.x或guzzle7
|
||||
|
||||
2.3.0 to 2.3.1
|
||||
---------
|
||||
- 修复文本检测的返回格式
|
||||
- 修复sample中的问题
|
||||
- 新增视频、文本、文档、音频检测
|
||||
- 新增媒体转码、截图、拼接
|
||||
|
||||
2.2.3 to 2.3.0
|
||||
---------
|
||||
- 新增图片审核,视频审核,音频审核,文本审核,文档审核接口
|
||||
- 新增单链接限速demo
|
||||
- 暴露getPresigned接口Headers和Params参数接口
|
||||
- 补充textDetect UT
|
||||
- 修复stream_for废弃问题
|
||||
- 修复x-cos头检测逻辑问题
|
||||
- 修复UT部分bug
|
||||
|
||||
2.2.2 to 2.2.3
|
||||
- 在putObejct中新增x-cos-tagging头
|
||||
- 修复`GetObjectWithoutSign`bug
|
||||
|
||||
2.2.1 to 2.2.2
|
||||
----------
|
||||
新增appendObject SDK,包括sample,service,test
|
||||
增加无签名对象下载地址 SDK,包括sample,service,test
|
||||
增加全球加速相关配置参数
|
||||
将COS_SECRETID修改为SECRETID、COS_SECRETKEY修改为SECRETKEY,防止混淆
|
||||
修复部分逻辑代码bug
|
||||
修复部分拼写错误
|
||||
- Add `AppendObject` interface
|
||||
- Add `GetObjectWithoutSign` interface
|
||||
- Add `allow_accelerate` param to client
|
||||
- Change const name `COS_SECRETID->SECRETID` `COS_SECRETKEY->SECRETKEY`
|
||||
- Fix `getPresigned` interface
|
||||
- Fix typo
|
||||
|
||||
2.2.0 to 2.2.1
|
||||
----------
|
||||
- Add `PutObjectTagging` interface
|
||||
- Add `GetObjectTagging` interface
|
||||
- Add `DeleteObjectTagging` interface
|
||||
|
||||
2.1.6 to 2.2.0
|
||||
----------
|
||||
- `PutObject` interface supports ci image process
|
||||
- `GetObject` interface supports ci image process
|
||||
- Add `ImageInfo` interface, which is used for get image info
|
||||
- Add `ImageExif` interface, which is used for get image exif
|
||||
- Add `ImageAve` interface, which is used for get image ave
|
||||
- Add `ImageProcess` interface, which is used for data processing on cloud
|
||||
- Add `Qrcode` interface, which is used for qrcode recognition
|
||||
- Add `QrcodeGenerate` interface, which is used for generate qrcode
|
||||
- Add `DetectLabel` interface, which is used for detect image label
|
||||
- Add `PutBucketImageStyle` interface, which is used for add bucket image style
|
||||
- Add `GetBucketImageStyle` interface, which is used for get bucket image style
|
||||
- Add `DeleteBucketImageStyle` interface, which is used for delete bucket image style
|
||||
- Add `PutBucketGuetzli` interface, which is used for open bucket guetzli state
|
||||
- Add `GetBucketGuetzli` interface, which is used for get bucket guetzli state
|
||||
- Add `DeleteBucketGuetzli` interface, which is used for close bucket guetzli state
|
||||
|
||||
2.1.5 to 2.1.6
|
||||
----------
|
||||
- Add `allow_redirects` parameter
|
||||
- Fix `selectObjectContent` interface
|
||||
|
||||
2.1.3 to 2.1.5
|
||||
----------
|
||||
- The `download` interface supports breakpoint
|
||||
- Rename `getPresignetUrl` to `getPresignedUrl`
|
||||
|
||||
2.1.2 to 2.1.3
|
||||
----------
|
||||
- Add `download` interface, which is used for concurrent block download
|
||||
- Add callback of `upload` and `download` progress
|
||||
- Fix request retry
|
||||
|
||||
2.1.1 to 2.1.2
|
||||
----------
|
||||
- The interface supports custom parameters
|
||||
- Fix `ListBucketInventoryConfigurations`
|
||||
|
||||
2.1.0 to 2.1.1
|
||||
----------
|
||||
- Fix bug of urlencode when calculating signature
|
||||
|
||||
2.0.9 to 2.1.0
|
||||
----------
|
||||
- `upload` support upload with multithread
|
||||
- Add `retry` params for interface retry
|
||||
- Support add customer header
|
||||
- Signature will restrict part of the header and all parameters
|
||||
- Fix `listBuckets` with `doamin`
|
||||
|
||||
2.0.8 to 2.0.9
|
||||
----------
|
||||
- Fix bug of `listObjectVersions`
|
||||
- Update `getObject` with param of `saveas`
|
||||
|
||||
2.0.7 to 2.0.8
|
||||
----------
|
||||
- Fix presigned url when using tmpSecretId/tmpSecretKey/Token
|
||||
|
||||
2.0.6 to 2.0.7
|
||||
----------
|
||||
- Fix response of `ListParts`
|
||||
|
||||
2.0.5 to 2.0.6
|
||||
----------
|
||||
- Support Domain
|
||||
- Add Select Object Content Interface
|
||||
- Add Traffic Limit
|
||||
- Fix bug of object endswith /
|
||||
|
||||
2.0.4 to 2.0.5
|
||||
----------
|
||||
- Fix bug when upload object with metadata
|
||||
|
||||
2.0.3 to 2.0.4
|
||||
----------
|
||||
- Fix bug when using ip-port
|
||||
|
||||
2.0.2 to 2.0.3
|
||||
----------
|
||||
- Fix path parse bug with /0/
|
||||
|
||||
2.0.1 to 2.0.2
|
||||
----------
|
||||
- Fix bug of `putObject` with `fopen`
|
||||
- Add ut
|
||||
|
||||
|
||||
2.0.0 to 2.0.1
|
||||
----------
|
||||
- Add interface of inventory/tagging/logging
|
||||
- Fix bug of some interface with query string
|
||||
|
||||
|
||||
1.3 to 2.0
|
||||
----------
|
||||
cos-php-sdk-v5 now uses [GuzzleHttp] for HTTP message.
|
||||
Due to fact, it depending on PHP >= 5.6.
|
||||
|
||||
- Use the `Qcloud\Cos\Client\getPresignetUrl()` method instead of the `Qcloud\Cos\Command\createPresignedUrl()`
|
||||
|
||||
v2:
|
||||
```php
|
||||
$signedUrl = $cosClient->getPresignetUrl($method='putObject',
|
||||
$args=['Bucket'=>'examplebucket-1250000000', 'Key'=>'exampleobject', 'Body'=>''],
|
||||
$expires='+30 minutes');
|
||||
```
|
||||
|
||||
v1:
|
||||
```php
|
||||
$command = $cosClient->getCommand('putObject', array(
|
||||
'Bucket' => "examplebucket-1250000000",
|
||||
'Key' => "exampleobject",
|
||||
'Body' => '',
|
||||
));
|
||||
$signedUrl = $command->createPresignedUrl('+30 minutes');
|
||||
```
|
||||
|
||||
- `$copSource` parameters of the `Qcloud\Cos\Client\Copy` interface are no longer compatible with older versions.
|
||||
|
||||
v2:
|
||||
|
||||
```php
|
||||
$result = $cosClient->copy(
|
||||
$bucket = '<srcBucket>',
|
||||
$Key = '<srcKey>',
|
||||
$copySorce = array(
|
||||
'Region' => '<sourceRegion>',
|
||||
'Bucket' => '<sourceBucket>',
|
||||
'Key' => '<sourceKey>',
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
v1:
|
||||
```php
|
||||
$result = $cosClient->Copy(
|
||||
$bucket = '<srcBucket>',
|
||||
$key = '<srcKey>',
|
||||
$copysource = '<sourceBucket>.cos.<sourceRegion>.myqcloud.com/<sourceKey>'
|
||||
);
|
||||
```
|
||||
- Now when uploading files with using `open()` to upload stream, if the local file does not exist, a 0 byte file will be uploaded without throwing an exception, only a warning.
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 腾讯云
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
# COS-PHP-SDK-V5
|
||||
|
||||
腾讯云 COS-PHP-SDK-V5([XML API](https://cloud.tencent.com/document/product/436/7751))
|
||||
|
||||
[](https://packagist.org/packages/qcloud/cos-sdk-v5)
|
||||
[](LICENSE)
|
||||
[](https://packagist.org/packages/qcloud/cos-sdk-v5)
|
||||
[](https://packagist.org/packages/qcloud/cos-sdk-v5)
|
||||
[](https://app.travis-ci.com/github/tencentyun/cos-php-sdk-v5)
|
||||
[](https://codecov.io/gh/tencentyun/cos-php-sdk-v5)
|
||||
[](https://github.com/tencentyun/cos-php-sdk-v5/actions/workflows/install.yml)
|
||||
|
||||
## 依赖
|
||||
|
||||
- [x] PHP >= 5.6
|
||||
> 如果您的 php 版本 `>=5.3` 且 `<5.6` , 请使用 [v1.3](https://github.com/tencentyun/cos-php-sdk-v5/tree/1.3) 版本
|
||||
|
||||
- [x] ext-curl
|
||||
- [x] ext-json
|
||||
- [x] ext-simplexml
|
||||
- [x] ext-mbstring
|
||||
|
||||
## 安装
|
||||
|
||||
SDK 安装有三种方式:
|
||||
|
||||
- [Composer 方式](#composer-方式)
|
||||
- [Phar 方式](#Phar-方式)
|
||||
- [源码方式](#源码方式)
|
||||
|
||||
### Composer 方式
|
||||
|
||||
推荐使用 Composer 安装 cos-php-sdk-v5,Composer 是 PHP 的依赖管理工具,允许您声明项目所需的依赖,然后自动将它们安装到您的项目中。
|
||||
|
||||
```bash
|
||||
composer require qcloud/cos-sdk-v5
|
||||
```
|
||||
|
||||
> 您可以在 [Composer 官网](https://getcomposer.org/) 上找到更多关于如何安装 Composer,配置自动加载以及用于定义依赖项的其他最佳实践等相关信息。
|
||||
|
||||
#### 安装步骤
|
||||
|
||||
1. 打开终端;
|
||||
2. 下载 Composer,执行以下命令:
|
||||
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
```
|
||||
|
||||
3. 创建一个名为`composer.json`的文件,内容如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"qcloud/cos-sdk-v5": "2.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. 使用 Composer 安装,执行以下命令:
|
||||
|
||||
```bash
|
||||
php composer.phar install
|
||||
```
|
||||
|
||||
使用该命令后会在当前目录中创建一个 vendor 文件夹,里面包含 SDK 的依赖库和一个 autoload.php 脚本,方便在项目中调用。
|
||||
|
||||
5. 通过 autoload.php 脚本调用 cos-php-sdk-v5:
|
||||
|
||||
```php
|
||||
require '/path/to/vendor/autoload.php';
|
||||
```
|
||||
|
||||
现在您的项目已经可以使用 COS 的 V5 版本 SDK 了。
|
||||
|
||||
### Phar 方式
|
||||
|
||||
Phar 方式安装 SDK 的步骤如下:
|
||||
|
||||
1. 在 [GitHub 发布页面](https://github.com/tencentyun/cos-php-sdk-v5/releases) 下载相应的 phar 文件;
|
||||
> 对于 PHP 版本`>= 5.6`且`<7.2.5`的用户请下载`cos-sdk-v5-6.phar`以使用 Guzzle6 版本。
|
||||
> 对于 PHP 版本`>=7.2.5`的用户请下载`cos-sdk-v5-7.phar`以使用 Guzzle7 版本。
|
||||
2. 在代码中引入 phar 文件:
|
||||
|
||||
```php
|
||||
require '/path/to/cos-sdk-v5.phar';
|
||||
```
|
||||
|
||||
### 源码方式
|
||||
|
||||
源码方式安装 SDK 的步骤如下:
|
||||
|
||||
1. 在 [GitHub 发布页面](https://github.com/tencentyun/cos-php-sdk-v5/releases) 下载相应的 cos-sdk-v5.tar.gz 文件;
|
||||
> 对于 PHP 版本`>= 5.6`且`<7.2.5`的用户请下载`cos-sdk-v5-6.tar.gz`以使用 Guzzle6 版本。
|
||||
> 对于 PHP 版本`>=7.2.5`的用户请下载`cos-sdk-v5-7.tar.gz`以使用 Guzzle7 版本。
|
||||
2. 解压后通过 autoload.php 脚本加载 SDK:
|
||||
|
||||
```php
|
||||
require '/path/to/cos-sdk-v5/vendor/autoload.php';
|
||||
```
|
||||
|
||||
## 快速入门
|
||||
|
||||
可参照 Demo 程序,详见 [sample 目录](https://github.com/tencentyun/cos-php-sdk-v5/tree/master/sample) 。
|
||||
|
||||
## 接口文档
|
||||
|
||||
PHP SDK 接口文档,详见 [https://cloud.tencent.com/document/product/436/12267](https://cloud.tencent.com/document/product/436/12267)
|
||||
|
||||
### 配置文件
|
||||
|
||||
```php
|
||||
$cosClient = new Qcloud\Cos\Client(array(
|
||||
'region' => '<Region>',
|
||||
'credentials' => array(
|
||||
'secretId' => '<SecretId>',
|
||||
'secretKey' => '<SecretKey>'
|
||||
)
|
||||
));
|
||||
```
|
||||
|
||||
若您使用 [临时密钥](https://cloud.tencent.com/document/product/436/14048) 初始化,请用下面方式创建实例。
|
||||
|
||||
```php
|
||||
$cosClient = new Qcloud\Cos\Client(array(
|
||||
'region' => '<Region>',
|
||||
'credentials' => array(
|
||||
'secretId' => '<SecretId>',
|
||||
'secretKey' => '<SecretKey>',
|
||||
'token' => '<XCosSecurityToken>'
|
||||
)
|
||||
));
|
||||
```
|
||||
|
||||
### 上传文件
|
||||
|
||||
- 使用 putObject 接口上传文件(最大 5G)
|
||||
- 使用 Upload 接口分块上传文件
|
||||
|
||||
```php
|
||||
# 上传文件
|
||||
## putObject(上传接口,最大支持上传5G文件)
|
||||
### 上传内存中的字符串
|
||||
//bucket 的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
|
||||
try {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'Body' => 'Hello World!'));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 上传文件流
|
||||
try {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'Body' => fopen($local_path, 'rb')));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 设置header和meta
|
||||
try {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'Body' => fopen($local_path, 'rb'),
|
||||
'ACL' => 'string',
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'StorageClass' => 'string'));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
## Upload(高级上传接口,默认使用分块上传最大支持50T)
|
||||
### 上传内存中的字符串
|
||||
try {
|
||||
$result = $cosClient->Upload(
|
||||
$bucket = $bucket,
|
||||
$key = $key,
|
||||
$body = 'Hello World!');
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 上传文件流
|
||||
try {
|
||||
$result = $cosClient->Upload(
|
||||
$bucket = $bucket,
|
||||
$key = $key,
|
||||
$body = fopen($local_path, 'rb'));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 设置header和meta
|
||||
try {
|
||||
$result = $cosClient->Upload(
|
||||
$bucket= $bucket,
|
||||
$key = $key,
|
||||
$body = fopen($local_path, 'rb'),
|
||||
$options = array(
|
||||
'ACL' => 'string',
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'StorageClass' => 'string'));
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
```
|
||||
|
||||
### 下载文件
|
||||
|
||||
- 使用 getObject 接口下载文件
|
||||
- 使用 getObjectUrl 接口获取文件下载 URL
|
||||
|
||||
```php
|
||||
# 下载文件
|
||||
## getObject(下载文件)
|
||||
### 下载到内存
|
||||
//bucket 的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
|
||||
try {
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key));
|
||||
echo($result['Body']);
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 下载到本地
|
||||
try {
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'SaveAs' => $local_path));
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 指定下载范围
|
||||
/*
|
||||
* Range 字段格式为 'bytes=a-b'
|
||||
*/
|
||||
try {
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'Range' => 'bytes=0-10',
|
||||
'SaveAs' => $local_path));
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
### 设置返回header
|
||||
try {
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => $bucket,
|
||||
'Key' => $key,
|
||||
'ResponseCacheControl' => 'string',
|
||||
'ResponseContentDisposition' => 'string',
|
||||
'ResponseContentEncoding' => 'string',
|
||||
'ResponseContentLanguage' => 'string',
|
||||
'ResponseContentType' => 'string',
|
||||
'ResponseExpires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime',
|
||||
'SaveAs' => $local_path));
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
## getObjectUrl(获取文件Url)
|
||||
try {
|
||||
$signedUrl = $cosClient->getObjectUrl($bucket, $key, '+10 minutes');
|
||||
echo $signedUrl;
|
||||
} catch (\Exception $e) {
|
||||
echo "$e\n";
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "qcloud/cos-sdk-v5",
|
||||
"description": "PHP SDK for QCloud COS",
|
||||
"keywords": [
|
||||
"qcloud", "cos", "php"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "yaozongyou",
|
||||
"email": "yaozongyou@vip.qq.com"
|
||||
},
|
||||
{
|
||||
"name": "lewzylu",
|
||||
"email": "327874225@qq.com"
|
||||
},
|
||||
{
|
||||
"name": "tuunalai",
|
||||
"email": "550566181@qq.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Qcloud\\Cos\\": "src/"
|
||||
},
|
||||
"files": ["src/Common.php"]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Qcloud\\Cos\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-libxml": "*",
|
||||
"guzzlehttp/guzzle": "^6.2.1 || ^7.0",
|
||||
"guzzlehttp/guzzle-services": "^1.1",
|
||||
"guzzlehttp/psr7": "^1.3.1 || ^2.0"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"@putenv XDEBUG_MODE=coverage",
|
||||
"phpunit -v --color=always"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//本接口用于创建一个数据集(Dataset),数据集是由文件元数据构成的集合,用于存储和管理元数据。
|
||||
$result = $cosClient->CreateDataset(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。命名规则如下: 长度为1~32字符。 只能包含小写英文字母,数字,短划线(-)。 必须以英文字母和数字开头。;是否必传:是
|
||||
'Description'=> 'test', // 数据集描述信息。长度为1~256个英文或中文字符,默认值为空。;是否必传:否
|
||||
'TemplateId'=> 'Official:COSBasicMeta', // 指模板,在建立元数据索引时,后端将根据模板来决定收集哪些元数据。每个模板都包含一个或多个算子,不同的算子表示不同的元数据。目前支持的模板: Official:DefaultEmptyId:默认为空的模板,表示不进行元数据的采集。 Official:COSBasicMeta:基础信息模板,包含 COS 文件基础元信息算子,表示采集 COS 文件的名称、类型、ACL等基础元信息数据。 Official:FaceSearch:人脸检索模板,包含人脸检索、COS 文件基础元信息算子。Official:ImageSearch:图像检索模板,包含图像检索、COS 文件基础元信息算子。;是否必传:否
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//本文档介绍创建数据集(Dataset)和对象存储(COS)Bucket 的绑定关系,绑定后将使用创建数据集时所指定算子对文件进行处理。绑定关系创建后,将对 COS 中新增的文件进行准实时的增量追踪扫描,使用创建数据集时所指定算子对文件进行处理,抽取文件元数据信息进行索引。通过此方式为文件建立索引后,您可以使用元数据查询API对元数据进行查询、管理和统计。
|
||||
$result = $cosClient->CreateDatasetBinding(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'URI'=> 'cos://examplebucket-1250000000', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://<BucketName>,其中BucketName表示COS存储桶名称,例如:cos://examplebucket-1250000000;是否必传:是
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//提取一个 COS 文件的元数据,在数据集中建立索引。会根据数据集中的算子提取不同的元数据建立索引,也支持建立自定义的元数据索引。
|
||||
$result = $cosClient->CreateFileMetaIndex(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test001', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
// 用于建立索引的文件信息。;是否必传:是
|
||||
'File'=> array(
|
||||
'CustomId'=> '001', // 自定义ID。该文件索引到数据集后,作为该行元数据的属性存储,用于和您的业务系统进行关联、对应。您可以根据业务需求传入该值,例如将某个URI关联到您系统内的某个ID。推荐传入全局唯一的值。在查询时,该字段支持前缀查询和排序,详情请见字段和操作符的支持列表。 ;是否必传:否
|
||||
'CustomLabels'=> array('age' => '18','level' => '18',)
|
||||
, // 自定义标签。您可以根据业务需要自定义添加标签键值对信息,用于在查询时可以据此为筛选项进行检索,详情请见字段和操作符的支持列表。 ;是否必传:否
|
||||
'MediaType'=> 'image', // 可选项,文件媒体类型,枚举值: image:图片。 other:其他。 document:文档。 archive:压缩包。 video:视频。 audio:音频。 ;是否必传:否
|
||||
'ContentType'=> 'image/jpeg', // 可选项,文件内容类型(MIME Type),如image/jpeg。 ;是否必传:否
|
||||
'URI'=> 'cos://examplebucket-1250000000/test.jpg', // 资源标识字段,表示需要建立索引的文件地址,当前仅支持COS上的文件,字段规则:cos:///,其中BucketName表示COS存储桶名称,ObjectKey表示文件完整路径,例如:cos://examplebucket-1250000000/test1/img.jpg。 注意: 1、仅支持本账号内的COS文件 2、不支持HTTP开头的地址;是否必传:是
|
||||
'MaxFaceNum'=> 20, // 输入图片中检索的人脸数量,默认值为20,最大值为20。(仅当数据集模板 ID 为 Official:FaceSearch 有效)。;是否必传:否
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//创建明水印模板
|
||||
$result = $cosClient->CreateWatermarkTemplate(array(
|
||||
'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/xml',
|
||||
),
|
||||
'Tag'=> 'undefined', // 模板类型: Watermark;是否必传:否
|
||||
'Name'=> 'undefined', // 模板名称,仅支持中文、英文、数字、_、-和*,长度不超过 64;是否必传:否
|
||||
// 水印信息;是否必传:否
|
||||
'Watermark'=> array(
|
||||
'Type'=> 'undefined', // 水印类型Text:文字水印Image:图片水印;是否必传:是
|
||||
'Pos'=> 'undefined', // 基准位置TopRightTopLeftBottomRightBottomLeftLeftRightTopBottomCenter;是否必传:是
|
||||
'LocMode'=> 'undefined', // 偏移方式Relativity:按比例Absolute:固定位置;是否必传:是
|
||||
'Dx'=> 'undefined', // 水平偏移在图片水印中,如果 Background 为 true,当 locMode 为 Relativity 时,为%,值范围:[-300 0];当 locMode 为 Absolute 时,为 px,值范围:[-4096 0]。在图片水印中,如果 Background 为 false,当 locMode 为 Relativity 时,为%,值范围:[0 100];当 locMode 为 Absolute 时,为 px,值范围:[0 4096]。在文字水印中,当 locMode 为 Relativity 时,为%,值范围:[0 100];当 locMode 为 Absolute 时,为 px,值范围:[0 4096]。当Pos为Top、Bottom和Center时,该参数无效。;是否必传:是
|
||||
'Dy'=> 'undefined', // 垂直偏移在图片水印中,如果 Background 为 true,当 locMode 为 Relativity 时,为%,值范围:[-300 0];当 locMode 为 Absolute 时,为 px,值范围:[-4096 0]。在图片水印中,如果 Background 为 false,当 locMode 为 Relativity 时,为%,值范围:[0 100];当 locMode 为 Absolute 时,为 px,值范围:[0 4096]。在文字水印中,当 locMode 为 Relativity 时,为%,值范围:[0 100];当 locMode 为 Absolute 时,为 px,值范围:[0 4096]。当Pos为Left、Right和Center时,该参数无效。;是否必传:是
|
||||
'StartTime'=> 'undefined', // 水印开始时间[0,视频时长] 单位为秒 支持 float 格式,执行精度精确到毫秒;是否必传:否
|
||||
'EndTime'=> 'undefined', // 水印结束时间[0,视频时长] 单位为秒 支持 float 格式,执行精度精确到毫秒;是否必传:否
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} 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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//从数据集中搜索与指定图片最相似的前N张图片并返回人脸坐标可对数据集内文件进行一个或多个人员的人脸识别。
|
||||
$result = $cosClient->DatasetFaceSearch(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'URI'=> 'cos://examplebucket-1250000000/test.jpg', // 资源标识字段,表示需要建立索引的文件地址。;是否必传:是
|
||||
'MaxFaceNum'=> 1, // 输入图片中检索的人脸数量,默认值为1(传0或不传采用默认值),最大值为10。;是否必传:否
|
||||
'Limit'=> 10, // 检索的每张人脸返回相关人脸数量,默认值为10,最大值为100。;是否必传:否
|
||||
'MatchThreshold'=> 10, // 出参 Score 中,只有超过 MatchThreshold 值的结果才会返回。范围:1-100,默认值为0,推荐值为80。;是否必传:否
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//可以根据已提取的文件元数据(包含文件名、标签、路径、自定义标签、文本等字段)查询和统计数据集内文件,支持逻辑关系表达方式。
|
||||
$result = $cosClient->DatasetSimpleQuery(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
// 简单查询参数条件,可自嵌套。;是否必传:是
|
||||
'Query'=> array(
|
||||
'Operation'=> 'and', // 操作运算符。枚举值: not:逻辑非。 or:逻辑或。 and:逻辑与。 lt:小于。 lte:小于等于。 gt:大于。 gte:大于等于。 eq:等于。 exist:存在性查询。 prefix:前缀查询。 match-phrase:字符串匹配查询。 nested:字段为数组时,其中同一对象内逻辑条件查询。;是否必传:是
|
||||
'SubQueries' => array(
|
||||
array(
|
||||
'Field'=> 'ContentType',
|
||||
'Value'=> 'image/jpeg',
|
||||
'Operation'=> 'eq',
|
||||
),
|
||||
array(
|
||||
'Field'=> 'Size',
|
||||
'Value'=> '1000',
|
||||
'Operation'=> 'gt',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
'MaxResults'=> 100, // 返回文件元数据的最大个数,取值范围为0200。 使用聚合参数时,该值表示返回分组的最大个数,取值范围为02000。 不设置此参数或者设置为0时,则取默认值100。;是否必传:否
|
||||
'Sort'=> 'CustomId', // 排序字段列表。请参考字段和操作符的支持列表。 多个排序字段可使用半角逗号(,)分隔,例如:Size,Filename。 最多可设置5个排序字段。 排序字段顺序即为排序优先级顺序。;是否必传:是
|
||||
'Order'=> 'desc', // 排序字段的排序方式。取值如下: asc:升序; desc(默认):降序。 多个排序方式可使用半角逗号(,)分隔,例如:asc,desc。 排序方式不可多于排序字段,即参数Order的元素数量需小于等于参数Sort的元素数量。例如Sort取值为Size,Filename时,Order可取值为asc,desc或asc。 排序方式少于排序字段时,未排序的字段默认取值asc。例如Sort取值为Size,Filename,Order取值为asc时,Filename默认排序方式为asc,即升序排列;是否必传:是
|
||||
// 聚合字段信息列表。 当您使用聚合查询时,仅返回聚合结果,不再返回匹配到的元信息列表。;是否必传:是
|
||||
'Aggregations'=> array(
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//删除一个数据集(Dataset)。
|
||||
$result = $cosClient->DeleteDataset(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//解绑数据集和对象存储(COS)Bucket ,解绑会导致 COS Bucket新增的变更不会同步到数据集,请谨慎操作。
|
||||
$result = $cosClient->DeleteDatasetBinding(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'URI'=> 'cos://examplebucket-1250000000', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://<BucketName>,其中BucketName表示COS存储桶名称,例如:cos://examplebucket-1250000000;是否必传:是
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//从数据集内删除一个文件的元信息。无论该文件的元信息是否在数据集内存在,均会返回删除成功。
|
||||
$result = $cosClient->DeleteFileMetaIndex(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'URI'=> 'cos://examplebucket-1250000000/test.jpg', // 资源标识字段,表示需要建立索引的文件地址。;是否必传:是
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//查询一个数据集(Dataset)信息。
|
||||
$result = $cosClient->DescribeDataset(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'datasetname' => '', // 数据集名称,同一个账户下唯一。
|
||||
'statistics' => 'false', // 是否需要实时统计数据集中文件相关信息。有效值: false:不统计,返回的文件的总大小、数量信息可能不正确也可能都为0。 true:需要统计,返回数据集中当前的文件的总大小、数量信息。 默认值为false。
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//查询数据集和对象存储(COS)Bucket 绑定关系列表。
|
||||
$result = $cosClient->DescribeDatasetBinding(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'datasetname' => '数据集名称', // 数据集名称,同一个账户下唯一。
|
||||
'uri' => 'uri', // 资源标识字段,表示需要与数据集绑定的资源,当前仅支持COS存储桶,字段规则:cos://,其中BucketName表示COS存储桶名称,例如(需要进行urlencode):cos%3A%2F%2Fexample-125000
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//查询数据集和对象存储(COS)Bucket 绑定关系列表。
|
||||
$result = $cosClient->DescribeDatasetBindings(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'datasetname' => '数据集名称', // 数据集名称,同一个账户下唯一。
|
||||
'maxresults' => '最大个数', // 返回绑定关系的最大个数,取值范围为0~200。不设置此参数或者设置为0时,则默认值为100。
|
||||
'nexttoken' => '下一页', // 当绑定关系总数大于设置的MaxResults时,用于翻页的token。从NextToken开始按字典序返回绑定关系信息列表。第一次调用此接口时,设置为空。
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//获取数据集(Dataset)列表。
|
||||
$result = $cosClient->DescribeDatasets(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'maxresults' => 100, // 本次返回数据集的最大个数,取值范围为0~200。不设置此参数或者设置为0时,则默认值为100。
|
||||
'nexttoken' => '下一页', // 翻页标记。当文件总数大于设置的MaxResults时,用于翻页的Token。从NextToken开始按字典序返回文件信息列表。填写上次查询返回的值,首次使用时填写为空。
|
||||
'prefix' => '数据集前缀', // 数据集名称前缀。
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//获取数据集内已完成索引的一个文件的元数据。
|
||||
$result = $cosClient->DescribeFileMetaIndex(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'datasetname' => '', // 数据集名称,同一个账户下唯一。
|
||||
'uri' => '', // 资源标识字段,表示需要建立索引的文件地址,当前仅支持COS上的文件,字段规则:cos:///,其中BucketName表示COS存储桶名称,ObjectKey表示文件完整路径,例如:cos://examplebucket-1250000000/test1/img.jpg。 注意: 1、仅支持本账号内的COS文件 2、不支持HTTP开头的地址 3、需UrlEncode
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//生成边转边播的播放列表能够分析视频文件产出 m3u8 文件。生成播放列表后即时播放,并根据播放进度实施按需转码,相比离线转码能极大减少了转码等待时间并大幅度降低了转码和存储开销
|
||||
$result = $cosClient->GeneratePlayList(array(
|
||||
'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/xml',
|
||||
),
|
||||
'Tag'=> 'undefined', // 创建任务的Tag:GeneratePlayList;是否必传:是
|
||||
// 待操作的文件信息;是否必传:是
|
||||
'Input'=> array(
|
||||
'Object'=> 'undefined', // 文件路径;是否必传:否
|
||||
),
|
||||
// 操作规则;是否必传:是
|
||||
'Operation'=> array(
|
||||
'UserData'=> 'undefined', // 透传用户信息, 可打印的 ASCII 码, 长度不超过1024;是否必传:否
|
||||
'JobLevel'=> 'undefined', // 任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0;是否必传:否
|
||||
),
|
||||
'CallBack'=> 'undefined', // 任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调;是否必传:否
|
||||
'CallBackFormat'=> 'undefined', // 任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式;是否必传:否
|
||||
'QueueType'=> 'undefined', // 任务所在的队列类型,限制为 SpeedTranscoding, 表示为开启倍速转码;是否必传:否
|
||||
'CallBackType'=> 'undefined', // 任务回调类型,Url 或 TDMQ,默认 Url,优先级高于队列的回调类型;是否必传:否
|
||||
// 任务回调TDMQ配置,当 CallBackType 为 TDMQ 时必填。详情见 CallBackMqConfig;是否必传:否
|
||||
'CallBackMqConfig'=> array(
|
||||
'MqRegion'=> 'undefined', // 消息队列所属园区,目前支持园区 sh(上海)、bj(北京)、gz(广州)、cd(成都)、hk(中国香港);是否必传:是
|
||||
'MqMode'=> 'undefined', // 消息队列使用模式,默认 Queue :主题订阅:Topic队列服务: Queue;是否必传:是
|
||||
'MqName'=> 'undefined', // TDMQ 主题名称;是否必传:是
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//该接口用于获取hls播放密钥。
|
||||
$result = $cosClient->GetHLSPlayKey(array(
|
||||
'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/xml',
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
$playKey = 'playKey';//替换为用户的 playKey,请通过该接口进行查看和管理,https://cloud.tencent.com/document/product/460/104329
|
||||
$bucket = 'examplebucket-1250000000';
|
||||
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
|
||||
$publicKey = "publicKey";
|
||||
$header = array(
|
||||
'alg' => 'HS256',
|
||||
'typ' => 'JWT'
|
||||
);
|
||||
$payload = array(
|
||||
"Type" => "CosCiToken",
|
||||
"AppId" => "1250000000",
|
||||
"BucketId" => $bucket,
|
||||
"Object" => "exampleobject",
|
||||
"Issuer" => "client",
|
||||
"IssuedTimeStamp" => time(),
|
||||
"ExpireTimeStamp" => time() + 3600 * 6,
|
||||
"UsageLimit" => 3,
|
||||
"ProtectScheme" => "rsa1024",
|
||||
"PublicKey" => base64_encode($publicKey),
|
||||
"ProtectContentKey" => 1,
|
||||
);
|
||||
$base64header = base64UrlEncode(json_encode($header, JSON_UNESCAPED_UNICODE));
|
||||
$base64payload = base64UrlEncode(json_encode($payload, JSON_UNESCAPED_UNICODE));
|
||||
$token = $base64header . '.' . $base64payload . '.' . base64UrlEncode(hash_hmac('sha256', $base64header . '.' . $base64payload, $playKey, true));
|
||||
echo $token;
|
||||
|
||||
function base64UrlEncode($input) {
|
||||
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
|
||||
}
|
||||
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//提交一个视频明水印任务
|
||||
$result = $cosClient->PostWatermarkJobs(array(
|
||||
'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/xml',
|
||||
),
|
||||
'Tag'=> 'undefined', // 创建任务的Tag:Watermark;是否必传:是
|
||||
// 待操作的文件信息;是否必传:是
|
||||
'Input'=> array(
|
||||
'Object'=> 'undefined', // 待处理的文件路径;是否必传:是
|
||||
),
|
||||
// 操作规则;是否必传:是
|
||||
'Operation'=> array(
|
||||
'WatermarkTemplateId'=> 'undefined', // 水印模板 ID,可以传多个水印模板 ID ,最多传3个;是否必传:否
|
||||
'UserData'=> 'undefined', // 透传用户信息,可打印的 ASCII 码,长度不超过1024。;是否必传:否
|
||||
'JobLevel'=> 'undefined', // 任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0;是否必传:否
|
||||
),
|
||||
'CallBackFormat'=> 'undefined', // 任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式;是否必传:否
|
||||
'CallBackType'=> 'undefined', // 任务回调类型,Url 或 TDMQ,默认 Url,优先级高于队列的回调类型;是否必传:否
|
||||
'CallBack'=> 'undefined', // 任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调;是否必传:否
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} 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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//可通过输入自然语言或图片,基于语义对数据集内文件进行图像检索。
|
||||
$result = $cosClient->SearchImage(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'ImageSearch001', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'Mode'=> 'pic', // 指定检索方式为图片或文本,pic 为图片检索,text 为文本检索,默认为 pic。;是否必传:否
|
||||
'URI'=> 'cos://examplebucket-1250000000/huge_base.jpg', // 资源标识字段,表示需要建立索引的文件地址(Mode 为 pic 时必选)。;是否必传:否
|
||||
'Limit'=> 10, // 返回相关图片的数量,默认值为10,最大值为100。;是否必传:否
|
||||
'MatchThreshold'=> 1, // 出参 Score(相关图片匹配得分) 中,只有超过 MatchThreshold 值的结果才会返回。默认值为0,推荐值为80。;是否必传:否
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//更新一个数据集(Dataset)信息。
|
||||
$result = $cosClient->UpdateDataset(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'Description'=> 'test', // 数据集描述信息。长度为1~256个英文或中文字符,默认值为空。;是否必传:否
|
||||
'TemplateId'=> 'Official:COSBasicMeta', // 该参数表示模板,在建立元数据索引时,后端将根据模板来决定收集哪些元数据。每个模板都包含一个或多个算子,不同的算子表示不同的元数据。目前支持的模板: Official:Empty:默认为空的模板,表示不进行元数据的采集。 Official:COSBasicMeta:基础信息模板,包含COS文件基础元信息算子,表示采集cos文件的名称、类型、acl等基础元信息数据。;是否必传:否
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//更新数据集内已索引的一个文件的部分元数据。并非所有的元数据都允许您自定义更新,在您发起更新请求时需要填写数据集,默认会根据该数据集的算子进行元数据重新提取并更新已存在的索引,此外您也可以更新部分自定义的元数据索引,如CustomTags、CustomId等字段,具体请参考请求参数一节。
|
||||
$result = $cosClient->UpdateFileMetaIndex(array(
|
||||
'AppId' => 'AppId', // 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
|
||||
'Headers' => array(
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
'DatasetName'=> 'test001', // 数据集名称,同一个账户下唯一。;是否必传:是
|
||||
'Callback'=> 'http://www.callback.com', // 元数据索引结果(以回调形式发送至您的回调地址,支持以 http:// 或者 https:// 开头的地址,例如: http://www.callback.com;是否必传:是
|
||||
// 用于建立索引的文件信息。;是否必传:是
|
||||
'File'=> array(
|
||||
'CustomId'=> '001', // 自定义ID。该文件索引到数据集后,作为该行元数据的属性存储,用于和您的业务系统进行关联、对应。您可以根据业务需求传入该值,例如将某个URI关联到您系统内的某个ID。推荐传入全局唯一的值。在查询时,该字段支持前缀查询和排序,详情请见字段和操作符的支持列表。 ;是否必传:否
|
||||
'CustomLabels'=> array('age' => '18','level' => '18',)
|
||||
, // 自定义标签。您可以根据业务需要自定义添加标签键值对信息,用于在查询时可以据此为筛选项进行检索,详情请见字段和操作符的支持列表。 ;是否必传:否
|
||||
'MediaType'=> 'image', // 可选项,文件媒体类型,枚举值: image:图片。 other:其他。 document:文档。 archive:压缩包。 video:视频。 audio:音频。 ;是否必传:否
|
||||
'ContentType'=> 'image/jpeg', // 可选项,文件内容类型(MIME Type),如image/jpeg。 ;是否必传:否
|
||||
'URI'=> 'cos://examplebucket-1250000000/test1/img.jpg', // 资源标识字段,表示需要建立索引的文件地址,当前仅支持COS上的文件,字段规则:cos:///,其中BucketName表示COS存储桶名称,ObjectKey表示文件完整路径,例如:cos://examplebucket-1250000000/test1/img.jpg。 注意: 1、仅支持本账号内的COS文件 2、不支持HTTP开头的地址;是否必传:是
|
||||
),
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', // 审核时必须为https
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
//该接口可以在不解压文件的情况下预览压缩包内的内容,包含文件数量、名称、文件时间等,接口为同步请求方式
|
||||
$result = $cosClient->ZipFilePreview(array(
|
||||
'Bucket' => '###bucketName###', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'ObjectKey' => 'undefined' // {ObjectKey}
|
||||
'Headers' => array(
|
||||
'Content-Type' => 'application/xml',
|
||||
),
|
||||
'ciProcess' => 'null', // 操作类型,压缩包预览计算固定为:zippreview
|
||||
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
// -------------------- 1. 人体识别 原图存储在COS -------------------- //
|
||||
$result = $cosClient->aIBodyRecognitionProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 1. 人体识别 原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 人体识别 原图来自其他链接 -------------------- //
|
||||
$result = $cosClient->aIBodyRecognitionProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // 该值为空即可
|
||||
'DetectUrl' => 'https://www.xxx.com/xxx.jpg',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 2. 人体识别 原图来自其他链接 -------------------- //
|
||||
} 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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
// -------------------- 1. 游戏场景识别 原图存储在COS -------------------- //
|
||||
$result = $cosClient->aIGameRecProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 1. 游戏场景识别 原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 游戏场景识别 原图来自其他链接 -------------------- //
|
||||
$result = $cosClient->aIGameRecProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // 该值为空即可
|
||||
'DetectUrl' => 'https://www.xxx.com/xxx.jpg',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 2. 游戏场景识别 原图来自其他链接 -------------------- //
|
||||
} 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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
$object = 'xxx.jpg';
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageColoring');
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', $object); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}"; // 携带签名的图片地址以“&”连接
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageColoring');
|
||||
$ciProcessParams->addParam('detect-url', 'https://xxx.com/xxx.jpg');
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', ''); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}";
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageColoring');
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, "output.png"); // rules
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'object.jpg',
|
||||
'Body' => fopen('/tmp/local.jpg', 'rb'), // 本地文件
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageColoring');
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, 'output.jpg'); // rules
|
||||
$result = $cosClient->ImageProcess(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
} 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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
$object = 'xxx.jpg';
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageCrop');
|
||||
$ciProcessParams->addParam('width', 100); // 需要裁剪区域的宽度,与height共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片宽度的像素值
|
||||
$ciProcessParams->addParam('height', 100); // 需要裁剪区域的高度,与width共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片高度的像素值;width : height建议取值在[1, 2.5]之间,超过这个范围可能会影响效果
|
||||
$ciProcessParams->addParam('fixed', 0); // 是否严格按照 width 和 height 的值进行输出。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', $object); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}"; // 携带签名的图片地址以“&”连接
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageCrop');
|
||||
$ciProcessParams->addParam('detect-url', 'https://xxx.com/xxx.jpg');
|
||||
$ciProcessParams->addParam('width', 100); // 需要裁剪区域的宽度,与height共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片宽度的像素值
|
||||
$ciProcessParams->addParam('height', 100); // 需要裁剪区域的高度,与width共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片高度的像素值;width : height建议取值在[1, 2.5]之间,超过这个范围可能会影响效果
|
||||
$ciProcessParams->addParam('fixed', 0); // 是否严格按照 width 和 height 的值进行输出。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', ''); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}";
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageCrop');
|
||||
$ciProcessParams->addParam('width', 100); // 需要裁剪区域的宽度,与height共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片宽度的像素值
|
||||
$ciProcessParams->addParam('height', 100); // 需要裁剪区域的高度,与width共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片高度的像素值;width : height建议取值在[1, 2.5]之间,超过这个范围可能会影响效果
|
||||
$ciProcessParams->addParam('fixed', 0); // 是否严格按照 width 和 height 的值进行输出。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, "output.png"); // rules
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'object.jpg',
|
||||
'Body' => fopen('/tmp/local.jpg', 'rb'), // 本地文件
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIImageCrop');
|
||||
$ciProcessParams->addParam('width', 100); // 需要裁剪区域的宽度,与height共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片宽度的像素值
|
||||
$ciProcessParams->addParam('height', 100); // 需要裁剪区域的高度,与width共同组成所需裁剪的图片宽高比例;输入数字请大于0、小于图片高度的像素值;width : height建议取值在[1, 2.5]之间,超过这个范围可能会影响效果
|
||||
$ciProcessParams->addParam('fixed', 0); // 是否严格按照 width 和 height 的值进行输出。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, 'output.jpg'); // rules
|
||||
$result = $cosClient->ImageProcess(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
} 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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
$object = 'xxx.jpg';
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIEnhanceImage');
|
||||
$ciProcessParams->addParam('denoise', 3); // 去噪强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行去噪操作,默认值为3。
|
||||
$ciProcessParams->addParam('sharpen', 3); // 锐化强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行锐化操作,默认值为3。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', $object); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}"; // 携带签名的图片地址以“&”连接
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIEnhanceImage');
|
||||
$ciProcessParams->addParam('detect-url', 'https://xxx.com/xxx.jpg');
|
||||
$ciProcessParams->addParam('denoise', 3); // 去噪强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行去噪操作,默认值为3。
|
||||
$ciProcessParams->addParam('sharpen', 3); // 锐化强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行锐化操作,默认值为3。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', ''); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}";
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIEnhanceImage');
|
||||
$ciProcessParams->addParam('denoise', 3); // 去噪强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行去噪操作,默认值为3。
|
||||
$ciProcessParams->addParam('sharpen', 3); // 锐化强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行锐化操作,默认值为3。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, "output.png"); // rules
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'object.jpg',
|
||||
'Body' => fopen('/tmp/local.jpg', 'rb'), // 本地文件
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AIEnhanceImage');
|
||||
$ciProcessParams->addParam('denoise', 3); // 去噪强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行去噪操作,默认值为3。
|
||||
$ciProcessParams->addParam('sharpen', 3); // 锐化强度值,取值范围为 0 - 5 之间的整数,值为 0 时不进行锐化操作,默认值为3。
|
||||
$ciProcessParams->addParam('ignore-error', 1); // 当此参数为1时,针对文件过大等导致处理失败的场景,会直接返回原图而不报错。
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, 'output.jpg'); // rules
|
||||
$result = $cosClient->ImageProcess(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
} 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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
$object = 'xxx.jpg';
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AISuperResolution');
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', $object); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}"; // 携带签名的图片地址以“&”连接
|
||||
// -------------------- 1. 下载时处理-原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AISuperResolution');
|
||||
$ciProcessParams->addParam('detect-url', 'https://xxx.com/xxx.jpg');
|
||||
$query = $ciProcessParams->queryString();
|
||||
$downloadUrl = $cosClient->getObjectUrl('examplebucket-1250000000', ''); // 获取下载链接
|
||||
echo "{$downloadUrl}&{$query}";
|
||||
// -------------------- 2. 下载时处理-原图来自其他链接 -------------------- //
|
||||
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AISuperResolution');
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, "output.png"); // rules
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'object.jpg',
|
||||
'Body' => fopen('/tmp/local.jpg', 'rb'), // 本地文件
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// ---------------------------- 3. 上传时处理 ---------------------------- //
|
||||
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
$ciProcessParams = new Qcloud\Cos\ImageParamTemplate\CIProcessTransformation('AISuperResolution');
|
||||
|
||||
$picOperations = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperations->setIsPicInfo(1); // is_pic_info
|
||||
$picOperations->addRule($ciProcessParams, 'output.jpg'); // rules
|
||||
$result = $cosClient->ImageProcess(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
'PicOperations' => $picOperations->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// --------------------- 4. 云上数据处理 ------------------------------ //
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
// -------------------- 1. 卡证识别 原图存储在COS -------------------- //
|
||||
$result = $cosClient->aILicenseRecProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'test.jpg',
|
||||
'CardType' => 'IDCard', // 卡证识别类型,有效值为IDCard,DriverLicense。<br>IDCard表示身份证;DriverLicense表示驾驶证,默认:DriverLicense
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 1. 卡证识别 原图存储在COS -------------------- //
|
||||
|
||||
// -------------------- 2. 卡证识别 原图来自其他链接 暂不支持 -------------------- //
|
||||
$result = $cosClient->aILicenseRecProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => '', // 该值为空即可
|
||||
'DetectUrl' => 'https://www.xxx.com/xxx.jpg',
|
||||
'CardType' => 'IDCard', // 卡证识别类型,有效值为IDCard,DriverLicense。<br>IDCard表示身份证;DriverLicense表示驾驶证,默认:DriverLicense
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 2. 卡证识别 原图来自其他链接 暂不支持 -------------------- //
|
||||
} 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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 实时文字翻译
|
||||
$result = $cosClient->autoTranslationBlockProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'InputText' => '', // 待翻译的文本
|
||||
'SourceLang' => '', // 输入语言,如 "zh"
|
||||
'TargetLang' => '', // 输出语言,如 "en"
|
||||
// 'TextDomain' => '', // 文本所属业务领域,如: "ecommerce", //缺省值为 general
|
||||
// 'TextStyle' => '', // 文本类型,如: "title", //缺省值为 sentence
|
||||
));
|
||||
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,
|
||||
'scheme' => '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,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,
|
||||
'scheme' => '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);
|
||||
$blindWatermarkTemplate->setVersion("2.0");
|
||||
|
||||
// -------------------- 1. 下载时处理 -------------------- //
|
||||
$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);
|
||||
// -------------------- 1. 下载时处理 -------------------- //
|
||||
|
||||
// -------------------- 2. 上传时处理 -------------------- //
|
||||
$local_path = "/data/exampleobject";
|
||||
$picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation();
|
||||
$picOperationsTemplate->setIsPicInfo(1);
|
||||
$picOperationsTemplate->addRule($blindWatermarkTemplate, "resultobject");
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'Body' => fopen($local_path, 'rb'),
|
||||
'PicOperations' => $picOperationsTemplate->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 2. 上传时处理 -------------------- //
|
||||
|
||||
// -------------------- 3. 云上数据处理 -------------------- //
|
||||
$result = $cosClient->ImageProcess(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Key' => 'exampleobject',
|
||||
'PicOperations' => $picOperationsTemplate->queryString(),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// -------------------- 3. 云上数据处理 -------------------- //
|
||||
} 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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,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,
|
||||
'scheme' => 'https', // 万象接口必须用https
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 关闭AI内容识别服务
|
||||
$result = $cosClient->closeAiService(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由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,
|
||||
'scheme' => 'https', // 万象接口必须用https
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 关闭智能语音服务 https://cloud.tencent.com/document/product/460/95755
|
||||
$result = $cosClient->closeAsrService(array(
|
||||
'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
));
|
||||
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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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, //园区
|
||||
'scheme' => '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', //时区
|
||||
'locationWithScheme' => true //Location中是否包含scheme
|
||||
)
|
||||
);
|
||||
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+60
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建音频降噪模板 https://cloud.tencent.com/document/product/460/94315
|
||||
$result = $cosClient->createMediaNoiseReductionTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'NoiseReduction',
|
||||
'Name' => 'NoiseReduction-Template',
|
||||
'NoiseReduction' => array(
|
||||
'Format' => 'wav',
|
||||
'Samplerate' => '16000',
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+45
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
<?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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交视频人像抠图任务
|
||||
// start --------------- 使用模版 暂不支持模版ID ----------------- //
|
||||
$result = $cosClient->createMediaSegmentVideoBodyJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SegmentVideoBody',
|
||||
'Input' => array(
|
||||
'Object' => 'input/test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '',
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'output/out.mp4',
|
||||
),
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaSegmentVideoBodyJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'SegmentVideoBody',
|
||||
'Input' => array(
|
||||
'Object' => 'input/test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'SegmentVideoBody' => array(
|
||||
'Mode' => 'Mask',
|
||||
'SegmentType' => '',
|
||||
'BackgroundGreen' => '',
|
||||
'BackgroundBlue' => '',
|
||||
'BackgroundLogoUrl' => '',
|
||||
'BinaryThreshold' => '',
|
||||
'RemoveRed' => '',
|
||||
'RemoveGreen' => '',
|
||||
'RemoveBlue' => '',
|
||||
),
|
||||
'Output' => array(
|
||||
'Region' => $region,
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'Object' => 'output/out.mp4',
|
||||
),
|
||||
// 'UserData' => '',
|
||||
// 'JobLevel' => '',
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} 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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+159
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,74 @@
|
||||
<?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,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 提交视频目标检测任务
|
||||
// start --------------- 使用模版 ----------------- //
|
||||
$result = $cosClient->createMediaTargetRecJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoTargetRec',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
'TemplateId' => '',
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 使用模版 ----------------- //
|
||||
|
||||
|
||||
// start --------------- 自定义参数 ----------------- //
|
||||
$result = $cosClient->createMediaTargetRecJobs(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoTargetRec',
|
||||
'Input' => array(
|
||||
'Object' => 'test.mp4',
|
||||
),
|
||||
'Operation' => array(
|
||||
// 'UserData' => 'xxx',
|
||||
// 'JobLevel' => '0',
|
||||
'VideoTargetRec' => array(
|
||||
'Body' => 'true',
|
||||
'Pet' => 'true',
|
||||
'Car' => 'false',
|
||||
),
|
||||
),
|
||||
// 'CallBack' => '',
|
||||
// 'CallBackFormat' => '',
|
||||
// 'CallBackType' => '',
|
||||
// 'CallBackMqConfig' => array(
|
||||
// 'MqRegion' => '',
|
||||
// 'MqMode' => '',
|
||||
// 'MqName' => '',
|
||||
// ),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
// end --------------- 自定义参数 ----------------- //
|
||||
} 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
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'scheme' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
// 创建视频目标检测模板
|
||||
$result = $cosClient->createMediaTargetRecTemplate(array(
|
||||
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
|
||||
'Tag' => 'VideoTargetRec',
|
||||
'Name' => 'template-name',
|
||||
'VideoTargetRec' => array(
|
||||
'Body' => 'true',
|
||||
'Pet' => 'true',
|
||||
'Car' => 'false',
|
||||
), // Body、Pet、Car 不能同时为 false
|
||||
));
|
||||
// 请求成功
|
||||
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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+61
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+65
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
+62
@@ -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,
|
||||
'scheme' => '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,
|
||||
'scheme' => '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);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user