first commit

This commit is contained in:
Your Name
2026-01-19 14:19:22 +08:00
commit fe2d9c1868
4777 changed files with 665503 additions and 0 deletions

View File

@@ -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@v3
- 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

View File

@@ -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@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
- name: Setup Dependencies
run:
composer install -o

371
vendor/qcloud/cos-sdk-v5/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,371 @@
cos-php-sdk-v5 Upgrade Guide
====================
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
vendor/qcloud/cos-sdk-v5/LICENSE vendored Normal file
View File

@@ -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
vendor/qcloud/cos-sdk-v5/README.md vendored Normal file
View File

@@ -0,0 +1,303 @@
# COS-PHP-SDK-V5
腾讯云 COS-PHP-SDK-V5[XML API](https://cloud.tencent.com/document/product/436/7751)
[![PHP Version](http://poser.pugx.org/qcloud/cos-sdk-v5/require/php)](https://packagist.org/packages/qcloud/cos-sdk-v5)
[![License](https://poser.pugx.org/qcloud/cos-sdk-v5/license)](LICENSE)
[![Latest Stable Version](https://poser.pugx.org/qcloud/cos-sdk-v5/v/stable)](https://packagist.org/packages/qcloud/cos-sdk-v5)
[![Total Downloads](https://img.shields.io/packagist/dt/qcloud/cos-sdk-v5.svg?style=flat)](https://packagist.org/packages/qcloud/cos-sdk-v5)
[![Build Status](https://api.travis-ci.com/tencentyun/cos-php-sdk-v5.svg?branch=master)](https://app.travis-ci.com/github/tencentyun/cos-php-sdk-v5)
[![codecov](https://codecov.io/gh/tencentyun/cos-php-sdk-v5/branch/master/graph/badge.svg)](https://codecov.io/gh/tencentyun/cos-php-sdk-v5)
[![Support Multiple Versions](https://github.com/tencentyun/cos-php-sdk-v5/actions/workflows/install.yml/badge.svg)](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-v5Composer 是 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";
}
```

57
vendor/qcloud/cos-sdk-v5/composer.json vendored Normal file
View File

@@ -0,0 +1,57 @@
{
"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": "*",
"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"
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 图片搜索接口 https://cloud.tencent.com/document/product/460/63901
$result = $cosClient->imageSearch(array(
'Bucket' => 'examplebucket-1250000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // ObjectKey
'MatchThreshold' => 0, // 出参 Score 中,只有超过 MatchThreshold 值的结果才会返回。默认为0
'Offset' => 0, // 起始序号默认值为0
'Limit' => 10, // 返回数量默认值为10最大值为100
'Filter' => '', // 针对入库时提交的 Tags 信息进行条件过滤。支持>、>=、<、<=、=、!=,多个条件之间支持 AND 和 OR 进行连接
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,29 @@
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 添加图库图片 https://cloud.tencent.com/document/product/460/63900
$result = $cosClient->imageSearchAdd(array(
'Bucket' => 'examplebucket-1250000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // ObjectKey
'EntityId' => '', // 物品 ID最多支持64个字符。若 EntityId 已存在,则对其追加图片
'CustomContent' => '', // 用户自定义的内容最多支持4096个字符查询时原样带回
'Tags' => '', // 图片自定义标签最多不超过10个json 字符串,格式为 key:value 对
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,27 @@
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 删除图库图片 https://cloud.tencent.com/document/product/460/63902
$result = $cosClient->imageSearchDelete(array(
'Bucket' => 'examplebucket-1250000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // ObjectKey
'EntityId' => '', // 物品 ID
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,27 @@
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 开通以图搜图 https://cloud.tencent.com/document/product/460/63899
$result = $cosClient->imageSearchOpen(array(
'Bucket' => 'examplebucket-1250000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'MaxCapacity' => 10000, // 图库容量限制
'MaxQps' => 10, // 图库访问限制默认10
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->abortMultipartUpload(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'UploadId' => 'string',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,30 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 设置防盗链 https://cloud.tencent.com/document/product/460/30116
$result = $cosClient->addHotLink(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Urls' => array(
'www.example1.com',
'www.example2.com',
'www.example3.com',
),
'Type' => 'white',
));
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,36 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
$local_path = "/data/exampleobject";
try {
$result = $cosClient->appendObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'Position' => 0, //追加对象位置
'Body' => fopen($local_path, 'rb'),//读取文件内容
));
/*
$result = $cosClient->appendObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'Position' => (integer)$result['Position'], //取出上一个追加文件的对象位置进行追加
'Body' => "hello", //文件流
));
*/
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 绑定数据万象服务 https://cloud.tencent.com/document/product/460/30108
$result = $cosClient->bindCiService(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,31 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate();
$blindWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg");
$blindWatermarkTemplate->setType(2);
$blindWatermarkTemplate->setLevel(3);
$result = $cosClient->getObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'ImageHandleParam' => $blindWatermarkTemplate->queryString(),
'SaveAs' => '/data/exampleobject'
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/71515 取消存量任务
$result = $cosClient->cancelInventoryTriggerJob(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // jobId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->cancelLiveVideoAuditing(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // jobId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,29 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->getBucketAcl(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
$statusCode = $e->getStatusCode(); // 获取错误码
$errorMessage = $e->getMessage(); // 获取错误信息
$requestId = $e->getRequestId(); // 获取错误的requestId
$errorCode = $e->getCosErrorCode(); // 获取错误名称
$request = $e->getRequest(); // 获取完整的请求
$response = $e->getResponse(); // 获取完整的响应
}

View File

@@ -0,0 +1,38 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate();
$imageMogrTemplate->thumbnailByScale(50);
$imageMogrTemplate->rotate(50);
$imageViewTemplate = new Qcloud\Cos\ImageParamTemplate\ImageViewTemplate();
$imageViewTemplate->setMode(1);
$imageViewTemplate->setWidth(400);
$imageViewTemplate->setHeight(600);
$imageViewTemplate->setQuality(1, 85);
$ciParamTransformation = new Qcloud\Cos\ImageParamTemplate\CIParamTransformation();
$ciParamTransformation->addRule($imageMogrTemplate);
$ciParamTransformation->addRule($imageViewTemplate);
$result = $cosClient->getObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'ImageHandleParam' => $ciParamTransformation->queryString(),
'SaveAs' => '/data/exampleobject',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 关闭原图保护 https://cloud.tencent.com/document/product/460/30122
$result = $cosClient->closeOriginProtect(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,36 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->completeMultipartUpload(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'UploadId' => 'string',
'Parts' => array(
array(
'ETag' => 'string',
'PartNumber' => integer,
),
array(
'ETag' => 'string',
'PartNumber' => integer,
)),
// ... repeated
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,31 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$local_path = "/data/exampleobject";
try {
$result = $cosClient->copy(
$bucket = 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
$key = 'exampleobject',
$copySource = array(
'Region' => '<sourceRegion>',
'Bucket' => '<sourceBucket>',
'Key' => '<sourceKey>',
)
);
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,27 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->copyObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
'CopySource' => urlencode('examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject'), //请注意这里需要urlencode防止因特殊字符产生的400或404错误
'MetadataDirective' => 'Replaced',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -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
$token = "COS_TMPTOKEN"; //如果使用永久密钥不需要填入token如果使用临时密钥需要填入临时密钥生成和使用指引参见https://cloud.tencent.com/document/product/436/14048
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region, //园区
'schema' => 'https', //协议头部默认为http
'timeout' => 10, //超时时间
'connect_timeout' => 10, //连接超时时间
'ip' => '', //ip
'port' => '', //端口
'endpoint' => '', //endpoint
'domain' => '', //domain可以填写用户自定义域名或者桶的全球加速域名
'proxy' => '', //代理服务器
'retry' => 10, //重试次数
'userAgent' => '', //UA
'allow_redirects' => false, //是否follow302
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey,
'token' => $token,
'anonymous' => true, //匿名模式
)
)
);

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createBucket(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,49 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createDocProcessJobs(array(
'Bucket' => 'examplebucket-1250000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'DocProcess', //任务的 TagDocProcess 固定值
'QueueId' => 'pd8e422a2ea134165a92f2012ea43****', //任务所在的队列 ID
'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);
}

View File

@@ -0,0 +1,54 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为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',
// 'QueueId' => 'pcc3ae89sa9d807fs89dg789sdg',
'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);
}

View File

@@ -0,0 +1,45 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/83108 提交哈希值计算任务-异步
$result = $cosClient->createFileHashCodeJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'FileHashCode',
// 'QueueId' => 'pcc3ae89sa9d807fs89dg789sdg',
'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);
}

View File

@@ -0,0 +1,49 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/83110 提交文件解压任务-异步
$result = $cosClient->createFileUncompressJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'FileUncompress',
// 'QueueId' => 'pcc3ae89sa9d807fs89dg789sdg',
'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);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->putObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'folder/',
'Body' => "",
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,39 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/71516 触发批量存量任务
$result = $cosClient->createInventoryTriggerJob(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Name' => '存量触发任务名称',
'Input' => array(
// 'Manifest' => '',
// 'UrlFile' => '',
// 'Prefix' => '',
'Object' => 'test01.png',
),
'Operation' => array(
'WorkflowIds' => 'w9938ed4b1435448783xxxxxxxxxxxxx',
// 'TimeInterval' => array(
// 'Start' => '',
// 'End' => '',
// ),
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,85 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交动图任务 https://cloud.tencent.com/document/product/436/54001
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaAnimationJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Animation',
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
'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',
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,43 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaAnimationTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Animation',
'Name' => 'Animation-Template-Name',
'Container' => array(
'Format' => '',
),
'Video' => array(
'Codec' => '',
'Width' => '',
'Height' => '',
'Fps' => '',
'AnimateOnlyKeepKeyFrame' => '',
'AnimateTimeIntervalOfFrame' => '',
'AnimateFramesPerSecond' => '',
'Quality' => '',
),
'TimeInterval' => array(
'Start' => '',
'Duration' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,100 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交拼接任务 https://cloud.tencent.com/document/product/436/54013
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaConcatJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Concat',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'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',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'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',
),
),
),
));
// 请求成功
print_r($result);
// end --------------- 自定义参数 ----------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,56 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/54041 新增拼接模板
$result = $cosClient->createMediaConcatTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Concat',
'Name' => 'Concat-Template-Name',
'ConcatTemplate' => array(
'ConcatFragments' => array(
array(
'Mode' => 'Start',
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/video01.mp4',
),
array(
'Mode' => 'End',
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/video02.mp4',
),
),
'Audio' => array(
'Codec' => 'aac',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
),
'Video' => array(
'Codec' => 'h.264',
'Width' => '',
'Height' => '',
'Fps' => '',
'Bitrate' => '',
'Remove' => 'false',
),
'Container' => array(
'Format' => 'mp4',
),
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,45 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 嵌入数字水印任务 https://cloud.tencent.com/document/product/436/65999
$result = $cosClient->createMediaDigitalWatermarkJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'DigitalWatermark',
'QueueId' => 'p81e648af2aee496885707caxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,39 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提取数字水印任务 https://cloud.tencent.com/document/product/436/66007
$result = $cosClient->createMediaExtractDigitalWatermarkJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'ExtractDigitalWatermark',
'QueueId' => 'p81e648af2aee496885707caxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,60 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/58307 新增极速高清转码模板
$result = $cosClient->createMediaHighSpeedHdTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'HighSpeedHd',
'Name' => 'HighSpeedHd-Template-Name',
'Container' => array(
'Format' => '',
),
'Video' => array(
'Codec' => '',
'Width' => '',
'Height' => '',
'Fps' => '',
'Profile' => '',
'Bitrate' => '',
'Crf' => '',
'Gop' => '',
'Preset' => '',
'Bufsize' => '',
'Maxrate' => '',
'HlsTsTime' => '',
'Pixfmt' => '',
),
'TimeInterval' => array(
'Start' => '',
'Duration' => '',
),
'Audio' => array(
'Codec' => '',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
),
'TransConfig' => array(
'IsCheckReso' => '',
'ResoAdjMethod' => '',
'IsHdr2Sdr' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,56 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 多任务接口 https://cloud.tencent.com/document/product/436/58335
$result = $cosClient->CreateMediaJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Transcode', // 可选单一任务时优先以Operation.Tag为准当Operation无Tag参数时该参数生效
'QueueId' => 'paaf4fce5521a40888a303xxxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,39 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaNoiseReductionJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'NoiseReduction',
'QueueId' => 'p81e648af2aee4968857xxxxxxxxxxxxxxxx',
'CallBack' => '',
'Input' => array(
'Object' => 'sound01.mp3',
),
'Operation' => array(
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-125000000',
'Object' => 'NoiseReduction.mp3',
),
// 'UserData' => 'xxx', // 透传用户信息
// 'JobLevel' => '0', // 任务优先级级别限制0 、1 、2。级别越大任务优先级越高默认为0
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,71 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为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',
'QueueId' => 'pcf4d6d9e5e734asd0as8d09as8d09a8d0',
'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',
'QueueId' => 'pcf4d6d9e5e734asd0as8d09as8d09a8d0',
'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);
}

View File

@@ -0,0 +1,31 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/67225 新增图片处理模板
$result = $cosClient->createMediaPicProcessTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'PicProcess',
'Name' => 'PicProcess-Template-Name',
'PicProcess' => array(
'IsPicInfo' => '',
'ProcessRule' => 'imageMogr2/rotate/90',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,45 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交视频质量评分任务 https://cloud.tencent.com/document/product/460/76906
$result = $cosClient->createMediaQualityEstimateJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'QualityEstimate',
'Input' => array(
'Object' => 'test.mp4',
),
'Operation' => array(
'UserData' => 'xxx', // 透传用户信息
// 'JobLevel' => '0', // 任务优先级级别限制0 、1 、2。级别越大任务优先级越高默认为0
// 'QualityEstimateConfig' => array(
// 'Rotate' => '',
// 'Mode' => '',
// ),
),
'CallBack' => 'http://xxx.com/callback',
'CallBackFormat' => 'JSON',
// 'CallBackType' => '',
// 'CallBackMqConfig' => array(
// 'MqRegion' => '',
// 'MqMode' => '',
// 'MqName' => '',
// ),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,45 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交 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',
'QueueId' => 'p81e648af2aee496885a8d09a8s09d8a0sd6',
'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);
}

View File

@@ -0,0 +1,48 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交转封装任务 https://cloud.tencent.com/document/product/436/67186
$result = $cosClient->createMediaSegmentJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Segment',
'QueueId' => 'p81e648af2aee496885707ca0xxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,50 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交智能封面任务 https://cloud.tencent.com/document/product/436/54017
$result = $cosClient->createMediaSmartCoverJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'SmartCover',
'QueueId' => 'p81e648afxxxxxxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,81 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交截图任务 https://cloud.tencent.com/document/product/436/76933
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaSnapshotJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Snapshot',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'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',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'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);
}

View File

@@ -0,0 +1,35 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/54029 新增截图模板
$result = $cosClient->createMediaSnapshotTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Snapshot',
'Name' => 'Snapshot-Template-Name',
'Snapshot' => array(
'Mode' => '',
'Start' => '',
'TimeInterval' => '',
'Count' => '',
'Width' => '',
'Height' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,56 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交一个音视频流分离任务 https://cloud.tencent.com/document/product/460/76911
$result = $cosClient->createMediaStreamExtractJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'StreamExtract',
'QueueId' => 'p81e648af2aee4968857xxxxxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,161 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交超分辨率任务 https://cloud.tencent.com/document/product/436/67210
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaSuperResolutionJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'SuperResolution',
'QueueId' => 'p81e648af2aee49688570xxxxxxxxxxx',
'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',
'QueueId' => 'p81e648af2aee49688570xxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,29 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaSuperResolutionTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'SuperResolution',
'Name' => 'SuperResolution-Template-Name',
'Resolution' => '',
'EnableScaleUp' => '',
'Version' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,124 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交转码任务 https://cloud.tencent.com/document/product/436/54009
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaTranscodeJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Transcode',
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
'Input' => array(
'Object' => 'example.mp4'
),
'Operation' => array(
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
// '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' => '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',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'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' => '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',
),
),
),
));
// 请求成功
print_r($result);
// end --------------- 自定义参数 ----------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,79 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/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' => '',
),
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,87 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交精彩集锦任务 https://cloud.tencent.com/document/product/436/58337
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaVideoMontageJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VideoMontage',
'QueueId' => 'p81e648af2aeexxxxxxxxxxxxxxxxxxx',
'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',
'QueueId' => 'p81e648af2aeexxxxxxxxxxxxxxxxxxx',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'VideoMontage' => array(
'Duration' => '',
'Container' => array(
'Format' => '',
),
'Video' => array(
'Codec' => '',
'Width' => '',
'Height' => '',
'Fps' => '',
'Bitrate' => '',
'Crf' => '',
),
'Audio' => array(
'Codec' => '',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
'Remove' => '',
),
),
'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);
}

View File

@@ -0,0 +1,51 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/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' => '',
'Container' => array(
'Format' => 'mp4',
),
'Video' => array(
'Codec' => 'H.264',
'Width' => '',
'Height' => '',
'Fps' => '',
'Bitrate' => '',
'Crf' => '',
),
'Audio' => array(
'Codec' => 'aac',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
'Remove' => '',
),
'AudioMix' => array(
'AudioSource' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/test01.mp3',
'MixMode' => 'Once',
'Replace' => 'true',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,157 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交视频增强任务 https://cloud.tencent.com/document/product/436/60750
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaVideoProcessJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VideoProcess',
'QueueId' => 'p81e648afxxxxxxxxxxxxxxxxx',
'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',
'QueueId' => 'p81e648afxxxxxxxxxxxxxxxxx',
'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);
}

View File

@@ -0,0 +1,37 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/60745 新增视频增强模板
$result = $cosClient->createMediaVideoProcessTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VideoProcess',
'Name' => 'VideoProcess-Template-Name',
'ColorEnhance' => array(
'Enable' => '',
'Contrast' => '',
'Correction' => '',
'Saturation' => '',
),
'MsSharpen' => array(
'Enable' => '',
'SharpenLevel' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,38 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交视频标签任务 https://cloud.tencent.com/document/product/436/67202
$result = $cosClient->createMediaVideoTagJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VideoTag',
'QueueId' => 'p81e648af2aee496885707ca0xxxxxxxxx',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'VideoTag' => array(
'Scenario' => 'Stream',
),
// 'UserData' => 'xxx', // 透传用户信息
// 'JobLevel' => '0', // 任务优先级级别限制0 、1 、2。级别越大任务优先级越高默认为0
),
'CallBack' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,77 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 提交人声分离任务 https://cloud.tencent.com/document/product/436/58341
// start --------------- 使用模版 ----------------- //
$result = $cosClient->createMediaVoiceSeparateJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VoiceSeparate',
'QueueId' => '',
'CallBack' => '',
'Input' => array(
'Object' => 'test.mp3'
),
'Operation' => array(
'TemplateId' => '',
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Object' => 'VoiceSeparate01.mp3',
'AuObject' => 'VoiceSeparate02.mp3',
),
// 'UserData' => 'xxx', // 透传用户信息
// 'JobLevel' => '0', // 任务优先级级别限制0 、1 、2。级别越大任务优先级越高默认为0
),
));
// 请求成功
print_r($result);
// end --------------- 使用模版 ----------------- //
// start --------------- 自定义参数 ----------------- //
$result = $cosClient->createMediaVoiceSeparateJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VoiceSeparate',
'QueueId' => '',
'CallBack' => '',
'Input' => array(
'Object' => 'test.mp3'
),
'Operation' => array(
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Object' => 'VoiceSeparate01.mp3',
'AuObject' => 'VoiceSeparate02.mp3',
),
'VoiceSeparate' => array(
'AudioMode' => 'AudioAndBackground',
'AudioConfig' => array(
'Codec' => 'mp3',
'Samplerate' => '11025',
'Bitrate' => '256',
'Channels' => '2',
),
),
// 'UserData' => 'xxx', // 透传用户信息
// 'JobLevel' => '0', // 任务优先级级别限制0 、1 、2。级别越大任务优先级越高默认为0
),
));
// 请求成功
print_r($result);
// end --------------- 自定义参数 ----------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,34 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/58315 新增人声分离模板
$result = $cosClient->createMediaVoiceSeparateTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'VoiceSeparate',
'Name' => 'VoiceSeparate-Template-Name',
'AudioMode' => 'IsAudio',
'AudioConfig' => array(
'Codec' => 'aac',
'Samplerate' => '',
'Bitrate' => '',
'Channels' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,70 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/54033 新增水印模板
// 文本水印
$result = $cosClient->createMediaWatermarkTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Watermark',
'Name' => 'Watermark-Template-Name',
'Watermark' => array(
'Type' => 'Text',
'Pos' => 'TopRight',
'LocMode' => 'Absolute',
'Dx' => '128',
'Dy' => '128',
'StartTime' => '',
'EndTime' => '',
'Text' => array(
'FontSize' => '30',
'FontType' => 'simfang',
'FontColor' => '0x000000',
'Transparency' => '30',
'Text' => '水印内容',
),
),
));
// 请求成功
print_r($result);
// 图片水印
$result = $cosClient->createMediaWatermarkTemplate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Watermark',
'Name' => 'Watermark-Template-Name',
'Watermark' => array(
'Type' => 'Image',
'Pos' => 'TopRight',
'LocMode' => 'Absolute',
'Dx' => '128',
'Dy' => '128',
'StartTime' => '',
'EndTime' => '',
'Image' => array(
'Url' => 'https://examplebucket-125000000.cos.ap-guangzhou.myqcloud.com/test01.png',
'Mode' => 'Proportion',
'Width' => '10',
'Height' => '',
'Transparency' => '100',
'Background' => '',
),
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,38 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMultipartUpload(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
/*
'CacheControl' => 'string',
'ContentDisposition' => 'string',
'ContentEncoding' => 'string',
'ContentLanguage' => 'string',
'ContentLength' => integer,
'ContentType' => 'string',
'Expires' => 'string',
'Metadata' => array(
'string' => 'string',
),
'StorageClass' => 'string'
*/
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucket(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucketCors(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucketDomain(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo "$e\n";
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->DeleteBucketGuetzli(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->DeleteBucketImageStyle(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'StyleName' => 'stylename',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucketLifecycle(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucketTagging(array(
'Bucket' => 'examplebucket-125000000' //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteBucketWebsite(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo "$e\n";
}

View File

@@ -0,0 +1,52 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
//列出所有buckets
$buckets = $cosClient->listBuckets();
//若bucket列表不为空则进行删除逻辑先删除对象再判断是否有上传的任务进行删除最后删除桶
if (!empty($buckets['Buckets'][0])) {
foreach ($buckets['Buckets'][0]['Bucket'] as $key => $value) {
$result = $cosClient->listObjects(array('Bucket' => $value['Name']));
if (isset($result['Contents'])) {
foreach ($result['Contents'] as $content) {
$cosClient->deleteObject(array('Bucket' => $value['Name'], 'Key' => $content['Key']));
}
}
while(True){
$result = $cosClient->ListMultipartUploads(
array('Bucket' => $value['Name']));
if ($result['Uploads'] == array()) {
break;
}
foreach ($result['Uploads'] as $upload) {
try {
$cosClient->AbortMultipartUpload(
array('Bucket' => $value['Name'],
'Key' => $upload['Key'],
'UploadId' => $upload['UploadId']));
} catch (\Exception $e) {
print_r($e);
}
}
}
$cosClient->deleteBucket(array('Bucket' => $value['Name']));
}
}
print_r('DELETE ALL BUCKETS SUCCEED!');
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,48 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$cos_path = "cos/folder";
$nextMarker = '';
$isTruncated = true;
while ( $isTruncated ) {
try {
$result = $cosClient->listObjects(
['Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Delimiter' => '',
'EncodingType' => 'url',
'Marker' => $nextMarker,
'Prefix' => $cos_path,
'MaxKeys' => 1000]
);
$isTruncated = $result['IsTruncated'];
$nextMarker = $result['NextMarker'];
foreach ( $result['Contents'] as $content ) {
$cos_file_path = $content['Key'];
$local_file_path = $content['Key'];
// 按照需求自定义拼接下载路径
try {
$cosClient->deleteObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => $cos_file_path,
));
echo ( $cos_file_path . "\n" );
} catch ( \Exception $e ) {
echo( $e );
}
}
} catch ( \Exception $e ) {
echo( $e );
}
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteObject(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->deleteObjectTagging(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/53990 删除工作流
$result = $cosClient->deleteWorkflow(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // WorkflowId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/71517 查询存量任务
$result = $cosClient->describeInventoryTriggerJob(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // jobId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,34 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/71518 批量拉取存量任务
$result = $cosClient->describeInventoryTriggerJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
// 'NextToken' => '',
// 'Size' => '',
// 'OrderByTime' => '',
// 'States' => '',
// 'StartCreationTime' => '',
// 'EndCreationTime' => '',
// 'WorkflowId' => '',
// 'JobId' => '',
// 'Name' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,26 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 查询指定的任务
$result = $cosClient->describeMediaJob(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '', // jobId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,31 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
/*
拉取符合条件的任务, 支持
Transcode、Snapshot、Animation、Concat、SmartCover、VideoProcess、VideoMontage、VoiceSeparate、SDRtoHDR、
DigitalWatermark、ExtractDigitalWatermark、SuperResolution、VideoTag、PicProcess、Segment
*/
$result = $cosClient->describeMediaJobs(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => 'Transcode', // 任务 的Tag
'QueueId' => 'paaf4fce5521a40888a3034a5dxxxxxxx', // queueId
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,31 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 查询模版列表
$result = $cosClient->describeMediaTemplates(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Tag' => '', // 模板 TagAnimation、Snapshot、Watermark、Transcode、Concat、HighSpeedHd、VideoMontage、VoiceSeparate、VideoProcess、PicProcess
'Category' => 'Custom',
'Ids' => '',
'Name' => '',
'PageNumber' => '',
'PageSize' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,29 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/53991 搜索工作流
$result = $cosClient->describeWorkflow(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
// 'Ids' => '',
// 'Name' => '',
// 'PageNumber' => '',
// 'PageSize' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,67 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// start --------------- 桶文件审核 ----------------- //
$result = $cosClient->detectAudio(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Object' => 'sound01.mp3',
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
// 'UserInfo' => array(
// 'TokenId' => '',
// 'Nickname' => '',
// 'DeviceId' => '',
// 'AppId' => '',
// 'Room' => '',
// 'IP' => '',
// 'Type' => '',
// 'ReceiveTokenId' => '',
// 'Gender' => '',
// 'Level' => '',
// 'Role' => '',
// ),
),
// 'Conf' => array(
// 'BizType' => '', // 可选 定制化策略
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数BizType为空时走默认策略BizType不为空走定制化策略
// 'Callback' => '', // 可选 回调URL
// 'CallbackVersion' => '', // 可选 回调内容的结构有效值Simple回调内容包含基本信息、Detail回调内容包含详细信息。默认为 Simple。
// ), // 可选 走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
// end --------------- 桶文件审核 ----------------- //
// start --------------- 音频文件地址审核 ----------------- //
$result = $cosClient->detectAudio(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => 'https://example.com/test.mp3',
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
// 'BizType' => '', // 可选 定制化策略
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数BizType为空时走默认策略BizType不为空走定制化策略
// 'Callback' => '', // 可选 回调URL
// 'CallbackVersion' => '', // 可选 回调内容的结构有效值Simple回调内容包含基本信息、Detail回调内容包含详细信息。默认为 Simple。
// ), // 可选 走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
// end --------------- 音频文件地址审核 ----------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,63 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 存储桶文档审核
$result = $cosClient->detectDocument(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Object' => 'test01.docx',
// 'Type' => 'docx',
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
// 'UserInfo' => array(
// 'TokenId' => '',
// 'Nickname' => '',
// 'DeviceId' => '',
// 'AppId' => '',
// 'Room' => '',
// 'IP' => '',
// 'Type' => '',
// 'ReceiveTokenId' => '',
// 'Gender' => '',
// 'Level' => '',
// 'Role' => '',
// ),
),
// 'Conf' => array(
// 'BizType' => '',
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填在只有BizType时走设定策略的审核场景
// 'Callback' => '', // 回调URL 选填
// ), // 选填 在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 文档URL审核
$result = $cosClient->detectDocument(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => 'https://example.com/test01.docx',
// 'Type' => 'docx',
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
// 'BizType' => '',
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填在只有BizType时走设定策略的审核场景
// 'Callback' => '', // 回调URL 选填
// ), // 选填 在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,55 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
//存储桶图片审核
$result = $cosClient->detectImage(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'test.png', // 桶文件
'ci-process' => 'sensitive-content-recognition',
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
// 'DetectType' => 'porn,ads', // 可选 不填走默认策略 或 定制化策略四种参数porn,ads等可使用多种规则注意规则间不要加空格
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量需大于0。
// 'LargeImageDetect' => '',
// 'DataId' => '',
// 'Async' => '',
// 'Callback' => '',
));
// 请求成功
print_r($result);
//图片链接审核
$imgUrl = 'https://test.jpg';
$result = $cosClient->detectImage(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => '/', // 链接图片资源路径写 / 即可
'ci-process' => 'sensitive-content-recognition',
'DetectUrl' => $imgUrl,
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
// 'DetectType' => 'porn,ads', // 可选 不填走默认策略 或 定制化策略四种参数porn,ads等可使用多种规则注意规则间不要加空格
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量需大于0。
// 'LargeImageDetect' => '',
// 'DataId' => '',
// 'Async' => '',
// 'Callback' => '',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,56 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 获取图片base64编码
// $localImageFile = '/tmp/test.jpg';
// $img = file_get_contents($localImageFile);
// $imgInfo = getimagesize($localImageFile);
// $imgBase64Content = base64_encode($img);
$result = $cosClient->detectImages(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Inputs' => array(
array(
'Object' => 'test01.png', // 桶文件
// 'Interval' => '', // 可选 审核 GIF 时使用 截帧的间隔
// 'MaxFrames' => '', // 可选 针对 GIF 动图审核的最大截帧数量需大于0。
// 'DataId' => 'aaa', // 可选 图片标识该字段在结果中返回原始内容长度限制为512字节
),
array(
'Url' => 'http://example.com/test.png', // 图片URL
// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量需大于0。
// 'DataId' => 'bbb', // 可选 图片标识该字段在结果中返回原始内容长度限制为512字节
),
// array(
// 'Content' => $imgBase64Content, // 图片文件的内容,需要先经过 base64 编码。
//// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔
//// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量需大于0。
//// 'DataId' => 'bbb', // 可选 图片标识该字段在结果中返回原始内容长度限制为512字节
// ),
),
// 'Conf' => array(
// 'BizType' => '', // 可选 定制化策略,不传走默认策略
// 'DetectType' => 'Porn,Ads', // 可选 不填走默认策略 或 定制化策略四种参数Porn,Ads等可使用多种规则注意规则间不要加空格
// 'Async' => 0, // 可选 是否异步进行审核0同步返回结果1异步进行审核。默认值为 0。
// 'Callback' => '', // 可选 审核结果Detail版本以回调形式发送至您的回调地址
// ) // 可选 在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->DetectLabel(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'exampleobject',
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,43 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->detectLiveVideo(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Type' => 'live_video',
'Input' => array(
'Url' => 'rtmp://example.com/live/123', // 直播流地址
// 'DataId' => '',
// 'UserInfo' => array(
// 'TokenId' => '',
// 'Nickname' => '',
// 'DeviceId' => '',
// 'AppId' => '',
// 'Room' => '',
// 'IP' => '',
// 'Type' => '',
// ),
),
'Conf' => array(
'Callback' => '',
// 'CallbackType' => 1,
'BizType' => '07d41bbb5a3a93dca4xxxxxxxxxxx', // 直播流审核 BizType 必填,可联系工作人员生成后使用
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,71 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// start --------------- 文本内容审核 ----------------- //
$content = '敏感词';
$result = $cosClient->detectText(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Content' => base64_encode($content), // 文本需base64_encode
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
// 'DetectType' => 'Porn,Terrorism,Politics,Ads,Illegal,Abuse', // 选填在只有BizType时走设定策略的审核场景
// 'BizType' => '',
// ), // 非必选在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
// end --------------- 文本内容审核 ----------------- //
// start --------------- 存储桶文本文件审核 ----------------- //
$result = $cosClient->detectText(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Object' => 'test01.txt'
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
// 'BizType' => '',
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填在只有BizType时走设定策略的审核场景
// 'Callback' => '', // 回调URL 选填
// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple
// ), // 非必选在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
// end --------------- 存储桶文本文件审核 ----------------- //
// start --------------- 文本文件Url审核 ----------------- //
$result = $cosClient->detectText(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => 'http://example.com/test.txt'
// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
// 'BizType' => '',
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填在只有BizType时走设定策略的审核场景
// 'Callback' => '', // 选填 回调URL
// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple
// ), // 非必选在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
// end --------------- 文本文件Url审核 ----------------- //
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,77 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
//存储桶视频审核
$result = $cosClient->detectVideo(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Object' => 'test.mp4', // 存储桶文件
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
// 'UserInfo' => array(
// 'TokenId' => '',
// 'Nickname' => '',
// 'DeviceId' => '',
// 'AppId' => '',
// 'Room' => '',
// 'IP' => '',
// 'Type' => '',
// 'ReceiveTokenId' => '',
// 'Gender' => '',
// 'Level' => '',
// 'Role' => '',
// ),
),
'Conf' => array(
// 'BizType' => '', // 可选 定制化策略
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略
// 'Callback' => '', // 可选 回调URL
// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音当值为0时表示只审核视频画面截图值为1时表示同时审核视频画面截图和视频声音。默认值为0。
// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构有效值Simple回调内容包含基本信息、Detail回调内容包含详细信息。默认为 Simple。
'Snapshot' => array(
// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式Average 表示平均模式Fps 表示固定帧率模式。
// 'TimeInterval' => 50, // 可选 视频截帧频率
'Count' => '3', // 视频截帧数量
),
),
));
//视频url审核
$videoUrl = 'http://example.com/test.mp4';
$result = $cosClient->detectVideo(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => $videoUrl, // 视频url
// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
'Conf' => array(
// 'BizType' => '', // 可选 定制化策略
// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略
// 'Callback' => '', // 可选 回调URL
// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音当值为0时表示只审核视频画面截图值为1时表示同时审核视频画面截图和视频声音。默认值为0。
// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构有效值Simple回调内容包含基本信息、Detail回调内容包含详细信息。默认为 Simple。
'Snapshot' => array(
// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式Average 表示平均模式Fps 表示固定帧率模式。
// 'TimeInterval' => 50, // 可选 视频截帧频率
'Count' => '3', // 视频截帧数量
),
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,44 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 存储桶文件查毒
$result = $cosClient->detectVirus(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Object' => 'test01.exe'
),
'Conf' => array(
'DetectType' => 'Virus',
// 'Callback' => '',
),
));
// URL查毒
$result = $cosClient->detectVirus(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => 'https://example.com/test01.exe',
),
'Conf' => array(
'DetectType' => 'Virus',
// 'Callback' => '',
),
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,33 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // 审核时必须为https
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
$result = $cosClient->detectWebpage(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Input' => array(
'Url' => 'https://www.xxx.com/',
// 'DataId' => '' // 可选 该字段在审核结果中会返回原始内容长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
),
// 'Conf' => array(
//// 'DetectType' => 'Porn,Ads', // 可选 不填走默认策略
//// 'ReturnHighlightHtml' => 'true', // 可选 'true' 或者 'false'
//// 'Callback' => '', // 可选
// ), // 可选 在DetectType/BizType都不传的情况下走默认策略及默认审核场景。
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,64 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// 1. 文档转码 https://cloud.tencent.com/document/product/460/47074
$bucket = 'examplebucket-125000000';
$key = 'exampleobject';
$url = $cosClient->getObjectUrl($bucket, $key);
$params = array(
'ci-process' => 'doc-preview',
// 'srcType' => '',
'page' => 3,
'dstType' => 'png',
// 'password' => '',
// 'comment' => '',
// 'sheet' => '',
// 'excelPaperDirection' => '',
// 'excelRow' => '',
// 'excelCol' => '',
// 'excelPaperSize' => '',
// 'txtPagination' => '',
'ImageParams' => 'imageMogr2/thumbnail/!50p',
// 'quality' => '',
// 'scale' => '',
// 'imageDpi' => '',
);
$query = http_build_query($params);
echo $url . $query; // 生成的可访问链接
// 2. 文档转HTML https://cloud.tencent.com/document/product/460/52518
$bucket = 'examplebucket-125000000';
$key = 'exampleobject';
$url = $cosClient->getObjectUrl($bucket, $key, "+30 minutes");
$params = array(
'ci-process' => 'doc-preview',
// 'srcType' => '',
'dstType' => 'html',
// 'sign' => '',
// 'copyable' => '',
// 'htmlParams' => '',
// 'htmlwaterword' => '',
// 'htmlfillstyle' => '',
// 'htmlfront' => '',
// 'htmlrotate' => '',
// 'htmlhorizontal' => '',
// 'htmlvertical' => '',
);
$query = http_build_query($params);
echo $url . $query; // 生成的可访问链接
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->doesBucketExist(
'examplebucket-125000000'//存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
); ;
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,25 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->doesObjectExist(
'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'exampleobject' //对象名
);
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,38 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$local_path = "/data/exampleobject";
$printbar = function($totalSize, $downloadedSize) {
printf("downloaded [%d/%d]\n", $downloadedSize, $totalSize);
};
try {
$result = $cosClient->download(
$bucket = 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
$key = 'exampleobject',
$saveAs = $local_path,
$options=['Progress' => $printbar, //指定进度条
'PartSize' => 10 * 1024 * 1024, //分块大小
'Concurrency' => 5, //并发数
'ResumableDownload' => true, //是否开启断点续传默认为false
'ResumableTaskFile' => 'tmp.cosresumabletask' //断点文件信息路径,默认为<localpath>.cosresumabletask
]
);
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,52 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey
)
)
);
$cos_path = 'cos/folder';
$nextMarker = '';
$isTruncated = true;
while ( $isTruncated ) {
try {
$result = $cosClient->listObjects(
['Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Delimiter' => '',
'EncodingType' => 'url',
'Marker' => $nextMarker,
'Prefix' => $cos_path,
'MaxKeys' => 1000]
);
} catch ( \Exception $e ) {
echo( $e );
}
$isTruncated = $result['IsTruncated'];
$nextMarker = $result['NextMarker'];
foreach ( $result['Contents'] as $content ) {
$cos_file_path = $content['Key'];
$local_file_path = $content['Key'];
// 按照需求自定义拼接下载路径
try {
$result = $cosClient->download(
$bucket = 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
$key = $cos_file_path,
$saveAs = $local_file_path
);
echo ( $cos_file_path . "\n" );
} catch ( \Exception $e ) {
echo( $e );
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
// https://cloud.tencent.com/document/product/436/83107 哈希值计算同步请求
$result = $cosClient->FileJobs4Hash(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
'Key' => 'for-test.mp4', // 桶文件
'Type' => 'md5', // 支持的哈希算法类型有效值md5、sha1、sha256
// 'AddToHeader' => 'true', // 是否将计算得到的哈希值自动添加至文件的自定义header格式为x-cos-meta-md5/sha1/sha256; 有效值: true、false不填则默认为false。
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
/**
* 可能出现的 Exception
* 1. Error Message: file processing is not active yet, please apply for file processing service first
* 解决方式:开通文件处理服务
*/
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials' => array(
'secretId' => $secretId,
'secretKey' => $secretKey)));
try {
// 获取动作顺序 https://cloud.tencent.com/document/product/460/48648
$result = $cosClient->getActionSequence(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,35 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$local_path = "/data/exampleobject";
try {
$blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate();
$blindWatermarkTemplate->setPick();
$blindWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg");
$blindWatermarkTemplate->setType(2);
$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);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

View File

@@ -0,0 +1,24 @@
<?php
require dirname(__FILE__, 2) . '/vendor/autoload.php';
$secretId = "SECRETID"; //替换为用户的 secretId请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; //替换为用户的 secretKey请登录访问管理控制台进行查看和管理https://console.cloud.tencent.com/cam/capi
$region = "ap-beijing"; //替换为用户的 region已创建桶归属的region可以在控制台查看https://console.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', //协议头部默认为http
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->getBucketAccelerate(array(
'Bucket' => 'examplebucket-125000000', //存储桶名称由BucketName-Appid 组成可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
));
// 请求成功
print_r($result);
} catch (\Exception $e) {
// 请求失败
echo($e);
}

Some files were not shown because too many files have changed in this diff Show More