Skip to content

Commit 1045018

Browse files
nic12347franktguo
andauthored
Pic add 0809 (#315)
* CI-文字水印参数补充 * CI-参数补充 * CI-图片相关接口 --------- Co-authored-by: franktguo <[email protected]>
1 parent f87d206 commit 1045018

10 files changed

+1543
-1
lines changed

sample/closeImageSlim.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
require dirname(__FILE__, 2) . '/vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
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->closeImageSlim(array(
17+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
18+
));
19+
print_r($result);
20+
} catch (\Exception $e) {
21+
// 请求失败
22+
echo($e);
23+
}
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
<?php
2+
3+
require dirname(__FILE__, 2) . '/vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
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+
// 提交画质增强任务 https://cloud.tencent.com/document/product/460/84775
17+
// start --------------- 使用模版 ----------------- //
18+
$result = $cosClient->createMediaVideoEnhanceJobs(array(
19+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
20+
'Tag' => 'VideoEnhance',
21+
'Input' => array(
22+
'Object' => 'test.mp4',
23+
),
24+
'Operation' => array(
25+
'TemplateId' => '', // 画质增强模板 ID
26+
'Output' => array(
27+
'Region' => $region,
28+
'Bucket' => 'examplebucket-125000000',
29+
'Object' => 'tmp/output.mp4',
30+
),
31+
// 'UserData' => 'xxx',
32+
// 'JobLevel' => '0',
33+
// 'WatermarkTemplateId' => array(
34+
// 'WatermarkTemplateId-1',
35+
// 'WatermarkTemplateId-2',
36+
// ),
37+
// 'Watermark' => array(
38+
// array(
39+
// 'Type' => '',
40+
// 'Pos' => '',
41+
// 'LocMode' => '',
42+
// 'Dx' => '',
43+
// 'Dy' => '',
44+
// 'StartTime' => '',
45+
// 'EndTime' => '',
46+
// 'Image' => array(
47+
// 'Url' => '',
48+
// 'Mode' => '',
49+
// 'Width' => '',
50+
// 'Height' => '',
51+
// 'Transparency' => '',
52+
// 'Background' => '',
53+
// ),
54+
// 'Text' => array(
55+
// 'FontSize' => '',
56+
// 'FontType' => '',
57+
// 'FontColor' => '',
58+
// 'Transparency' => '',
59+
// 'Text' => '',
60+
// ),
61+
// 'SlideConfig' => array(
62+
// 'SlideMode' => '',
63+
// 'XSlideSpeed' => '',
64+
// 'YSlideSpeed' => '',
65+
// ),
66+
// ),
67+
// ),
68+
// 'DigitalWatermark' => array(
69+
// 'Message' => '',
70+
// 'Type' => '',
71+
// 'Version' => '',
72+
// 'IgnoreError' => '',
73+
// 'State' => '',
74+
// ),
75+
),
76+
// 'CallBack' => '',
77+
// 'CallBackFormat' => '',
78+
// 'CallBackType' => '',
79+
// 'CallBackMqConfig' => array(
80+
// 'MqRegion' => '',
81+
// 'MqMode' => '',
82+
// 'MqName' => '',
83+
// ),
84+
));
85+
// 请求成功
86+
print_r($result);
87+
// end --------------- 使用模版 ----------------- //
88+
89+
// start --------------- 自定义参数 ----------------- //
90+
$result = $cosClient->createMediaVideoEnhanceJobs(array(
91+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
92+
'Tag' => 'VideoEnhance',
93+
'Input' => array(
94+
'Object' => 'test.mp4',
95+
),
96+
'Operation' => array(
97+
// 画质增强参数
98+
'VideoEnhance' => array(
99+
'Transcode' => array(
100+
'Container' => array(
101+
'Format' => 'mp4',
102+
),
103+
'Video' => array(
104+
'Codec' => 'H.264',
105+
'Width' => '1280',
106+
'Height' => '920',
107+
'Fps' => '30',
108+
),
109+
'Audio' => array(
110+
'Codec' => 'aac',
111+
'Samplerate' => '44100',
112+
'Bitrate' => '128',
113+
'Channels' => '4',
114+
),
115+
),
116+
'SuperResolution' => array(
117+
'Resolution' => 'sdtohd',
118+
'EnableScaleUp' => 'true',
119+
'Version' => 'Enhance',
120+
),
121+
'SDRtoHDR' => array(
122+
'HdrMode' => 'HDR10',
123+
),
124+
'ColorEnhance' => array(
125+
'Contrast' => '50',
126+
'Correction' => '100',
127+
'Saturation' => '100',
128+
),
129+
'MsSharpen' => array(
130+
'SharpenLevel' => '5',
131+
),
132+
'FrameEnhance' => array(
133+
'FrameDoubling' => 'true',
134+
),
135+
),
136+
'Output' => array(
137+
'Region' => $region,
138+
'Bucket' => 'examplebucket-125000000',
139+
'Object' => 'tmp/output.mp4',
140+
),
141+
// 'UserData' => 'xxx',
142+
// 'JobLevel' => '0',
143+
// 'WatermarkTemplateId' => array(
144+
// 'WatermarkTemplateId-1',
145+
// 'WatermarkTemplateId-2',
146+
// ),
147+
// 'Watermark' => array(
148+
// array(
149+
// 'Type' => '',
150+
// 'Pos' => '',
151+
// 'LocMode' => '',
152+
// 'Dx' => '',
153+
// 'Dy' => '',
154+
// 'StartTime' => '',
155+
// 'EndTime' => '',
156+
// 'Image' => array(
157+
// 'Url' => '',
158+
// 'Mode' => '',
159+
// 'Width' => '',
160+
// 'Height' => '',
161+
// 'Transparency' => '',
162+
// 'Background' => '',
163+
// ),
164+
// 'Text' => array(
165+
// 'FontSize' => '',
166+
// 'FontType' => '',
167+
// 'FontColor' => '',
168+
// 'Transparency' => '',
169+
// 'Text' => '',
170+
// ),
171+
// 'SlideConfig' => array(
172+
// 'SlideMode' => '',
173+
// 'XSlideSpeed' => '',
174+
// 'YSlideSpeed' => '',
175+
// ),
176+
// ),
177+
// ),
178+
// 'DigitalWatermark' => array(
179+
// 'Message' => '',
180+
// 'Type' => '',
181+
// 'Version' => '',
182+
// 'IgnoreError' => '',
183+
// 'State' => '',
184+
// ),
185+
),
186+
// 'CallBack' => '',
187+
// 'CallBackFormat' => '',
188+
// 'CallBackType' => '',
189+
// 'CallBackMqConfig' => array(
190+
// 'MqRegion' => '',
191+
// 'MqMode' => '',
192+
// 'MqName' => '',
193+
// ),
194+
));
195+
// 请求成功
196+
print_r($result);
197+
// end --------------- 自定义参数 ----------------- //
198+
} catch (\Exception $e) {
199+
// 请求失败
200+
echo($e);
201+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
require dirname(__FILE__, 2) . '/vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
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+
// https://cloud.tencent.com/document/product/460/84722 创建画质增强模板
17+
$result = $cosClient->createMediaVideoEnhanceTemplate(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'VideoEnhance',
20+
'Name' => 'TemplateName',
21+
'VideoEnhance' => array(
22+
'Transcode' => array(
23+
'Container' => array(
24+
'Format' => 'mp4',
25+
),
26+
'Video' => array(
27+
'Codec' => 'H.264',
28+
'Width' => '1280',
29+
'Height' => '920',
30+
'Fps' => '30',
31+
),
32+
'Audio' => array(
33+
'Codec' => 'aac',
34+
'Samplerate' => '44100',
35+
'Bitrate' => '128',
36+
'Channels' => '4',
37+
),
38+
),
39+
'SuperResolution' => array(
40+
'Resolution' => 'sdtohd',
41+
'EnableScaleUp' => 'true',
42+
'Version' => 'Enhance',
43+
),
44+
'SDRtoHDR' => array(
45+
'HdrMode' => 'HDR10',
46+
),
47+
'ColorEnhance' => array(
48+
'Contrast' => '50',
49+
'Correction' => '100',
50+
'Saturation' => '100',
51+
),
52+
'MsSharpen' => array(
53+
'SharpenLevel' => '5',
54+
),
55+
'FrameEnhance' => array(
56+
'FrameDoubling' => 'true',
57+
),
58+
),
59+
));
60+
// 请求成功
61+
print_r($result);
62+
} catch (\Exception $e) {
63+
// 请求失败
64+
echo($e);
65+
}

sample/getImageSlim.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
require dirname(__FILE__, 2) . '/vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
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->getImageSlim(array(
17+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
18+
));
19+
print_r($result);
20+
} catch (\Exception $e) {
21+
// 请求失败
22+
echo($e);
23+
}

sample/openImageSlim.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
require dirname(__FILE__, 2) . '/vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
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->openImageSlim(array(
17+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
18+
'SlimMode' => 'API',
19+
'Suffixs' => array(
20+
'Suffix' => array(
21+
'jpg',
22+
'png',
23+
),
24+
),
25+
));
26+
print_r($result);
27+
} catch (\Exception $e) {
28+
// 请求失败
29+
echo($e);
30+
}

0 commit comments

Comments
 (0)