123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- require dirname(__FILE__, 2) . '/vendor/autoload.php';
- $secretId = "SECRETID";
- $secretKey = "SECRETKEY";
- $region = "ap-beijing";
- $cosClient = new Qcloud\Cos\Client(
- array(
- 'region' => $region,
- 'scheme' => 'https',
- 'credentials'=> array(
- 'secretId' => $secretId,
- 'secretKey' => $secretKey)));
- try {
-
-
- $result = $cosClient->updateMediaWatermarkTemplate(array(
- 'Bucket' => 'examplebucket-125000000',
- 'Key' => '',
- '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->updateMediaWatermarkTemplate(array(
- 'Bucket' => 'examplebucket-125000000',
- 'Key' => '',
- 'Tag' => 'Watermark',
- 'Name' => 'Watermark-Template-Name2-1',
- '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);
- }
|