Skip to content

Commit 98168d1

Browse files
authored
prerelease 2.3.2 (#229)
* feat(*):添加新特性,修复bug - 视频截帧,视频信息查询,put/get bucket referer - CRC添加 - 修复默认分块过大导致上传失败的问题 - 修复图片鉴定ci-process param出现两次的bug - 依赖更新 - action添加
1 parent 7d30c55 commit 98168d1

23 files changed

+1214
-79
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/.gitattributes export-ignore
22
/.gitignore export-ignore
33
/.travis.yml export-ignore
4-
/phpunit.xml export-ignore
5-
/src/Qcloud/Cos/Tests export-ignore
64
/bin export-ignore

.github/workflows/php5.6.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PHP 5.6
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:5.6
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Prepare
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
32+
composer install
33+
- name: Test
34+
run: for i in `ls src/Qcloud/Cos/*.php`; do php -l $i; done

.github/workflows/php7.1.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PHP 7.1
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:7.1
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Test
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
32+
composer install
33+
composer require --dev phpunit/phpunit
34+
./vendor/bin/phpunit
35+
- name: codecov
36+
uses: codecov/codecov-action@v2

.github/workflows/php7.2.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PHP 7.2
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:7.2
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Test
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
pecl install xdebug
32+
docker-php-ext-enable xdebug
33+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
34+
composer install
35+
composer require --dev phpunit/phpunit
36+
XDEBUG_MODE=coverage ./vendor/bin/phpunit
37+
- name: codecov
38+
uses: codecov/codecov-action@v2

.github/workflows/php7.3.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PHP 7.3
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:7.3
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Test
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
pecl install xdebug
32+
docker-php-ext-enable xdebug
33+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
34+
composer install
35+
composer require --dev phpunit/phpunit
36+
XDEBUG_MODE=coverage ./vendor/bin/phpunit
37+
- name: codecov
38+
uses: codecov/codecov-action@v2

.github/workflows/php7.4.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: PHP 7.4
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:7.4
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Prepare
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
pecl install xdebug
32+
docker-php-ext-enable xdebug
33+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
34+
composer require --dev phpunit/phpunit
35+
- name: Test
36+
run: |
37+
XDEBUG_MODE=coverage ./vendor/bin/phpunit

.github/workflows/php8.0.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PHP 8.0
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
env:
11+
COS_REGION: ${{ secrets.COS_REGION }}
12+
COS_APPID: ${{ secrets.COS_APPID }}
13+
COS_SECRET: ${{ secrets.COS_SECRET }}
14+
COS_KEY: ${{ secrets.COS_KEY }}
15+
COS_BUCKET: ${{ secrets.COS_BUCKET }}
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
container:
21+
image: php:8.0
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Prepare
27+
run: |
28+
apt update
29+
apt install -y libzip-dev unzip
30+
docker-php-ext-install zip
31+
pecl install xdebug
32+
docker-php-ext-enable xdebug
33+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
34+
composer require --dev phpunit/phpunit
35+
- name: Test
36+
run: |
37+
XDEBUG_MODE=coverage ./vendor/bin/phpunit
38+
- name: codecov
39+
uses: codecov/codecov-action@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
vendor/
55
*.DS_Store
66
index.php
7+
clover.xml

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
cos-php-sdk-v5 Upgrade Guide
22
====================
3+
4+
2.3.1 to 2.3.2
5+
---------
6+
- 新增视频截帧,视频信息查询示例
7+
- 新增PUT/GET Bucket Referer示例
8+
- 对于相应接口添加CRC返回信息
9+
- 修复图片审核中ci-process param出现两次的问题
10+
- 修复PHP5.6 版本的依赖问题
11+
- 根据PHP版本自动composer install guzzle6.x或guzzle7
12+
13+
2.3.0 to 2.3.1
14+
---------
15+
- 修复文本检测的返回格式
16+
- 修复sample中的问题
17+
- 新增视频、文本、文档、音频检测
18+
- 新增媒体转码、截图、拼接
19+
320
2.2.3 to 2.3.0
421
---------
522
- 新增图片审核,视频审核,音频审核,文本审核,文档审核接口

bin/release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Usage: php bin/release or php bin/release version
77
*/
88

9-
require_once 'vendor/autoload.php';
9+
require_once '../vendor/autoload.php';
1010

1111
use Qcloud\Cos\Client;
1212
use Qcloud\Cos\Service;

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@
2626
"files": ["src/Qcloud/Cos/Common.php"]
2727
},
2828
"require": {
29-
"php": ">=5.3.0",
30-
"guzzlehttp/guzzle": "~6.3",
31-
"guzzlehttp/guzzle-services": "~1.1"
29+
"php": ">=5.6",
30+
"guzzlehttp/guzzle": ">=6.2.1",
31+
"guzzlehttp/guzzle-services": ">=1.1",
32+
"guzzlehttp/psr7": "<2.0"
33+
},
34+
"config": {
35+
"platform-check": false
3236
}
3337
}

sample/copy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$result = $cosClient->copy(
1818
$bucket = 'examplebucket-125000000', //格式:BucketName-APPID
1919
$key = 'exampleobject',
20-
$copySorce = array(
20+
$copySource = array(
2121
'Region' => '<sourceRegion>',
2222
'Bucket' => '<sourceBucket>',
2323
'Key' => '<sourceKey>',

sample/getBucketReferer.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //"云 API 密钥 SecretId";
6+
$secretKey = "SECRETKEY"; //"云 API 密钥 SecretKey";
7+
$region = "ap-beijing"; //设置一个默认的存储桶地域
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials' => array(
13+
'secretId' => $secretId,
14+
'secretKey' => $secretKey)));
15+
try {
16+
$result = $cosClient->getBucketReferer(array(
17+
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
18+
)
19+
);
20+
// 请求成功
21+
echo($result);
22+
} catch (\Exception $e) {
23+
// 请求失败
24+
echo($e);
25+
}

sample/getMediaInfo.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //"云 API 密钥 SecretId";
6+
$secretKey = "SECRETKEY"; //"云 API 密钥 SecretKey";
7+
$region = "ap-beijing"; //设置一个默认的存储桶地域
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
16+
try {
17+
$result = $cosClient->GetMediaInfo(
18+
array(
19+
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
20+
'Key' =>'exampleobject', //桶中的媒体文件,如test.mp4
21+
'ci-process' => 'videoinfo' //操作类型,固定使用 videoinfo
22+
)
23+
);
24+
// 请求成功
25+
echo($result);
26+
} catch (\Exception $e) {
27+
// 请求失败
28+
echo($e);
29+
}

sample/getObjectSensitiveContentRecognition.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
$result = $cosClient->getObjectSensitiveContentRecognition(array(
1818
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
1919
'Key' => 'exampleobject',
20-
'DetectType' => 'porn,politics' //可选四种参数:porn,politics,terrorist,ads,可使用多种规则,注意规则间不要加空格
20+
'DetectType' => 'porn,politics', //可选四种参数:porn,politics,terrorist,ads,可使用多种规则,注意规则间不要加空格
21+
'ci-process' => 'sensitive-content-recognition',
2122
// 'Interval' => 5, // 审核gif时使用 截帧的间隔
2223
// 'MaxFrames' => 5, // 针对 GIF 动图审核的最大截帧数量,需大于0。
2324
// 'BizType' => '', // 审核策略
@@ -33,6 +34,7 @@
3334
'Key' => '/', // 链接图片资源路径写 / 即可
3435
'DetectType' => 'porn,ads',//可选四种参数:porn,politics,terrorist,ads,可使用多种规则,注意规则间不要加空格
3536
'DetectUrl' => $imgUrl,
37+
'ci-process' => 'sensitive-content-recognition',
3638
// 'Interval' => 5, // 审核gif时使用 截帧的间隔
3739
// 'MaxFrames' => 5, // 针对 GIF 动图审核的最大截帧数量,需大于0。
3840
// 'BizType' => '', // 审核策略

0 commit comments

Comments
 (0)