日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

水印模板

媒體處理中添加圖片水印時支持通過水印模板配置水印類型、水印圖片等參數,本文為您介紹媒體處理PHP SDK水印模塊相關功能的API調用示例。

前提條件

使用前請先安裝及完成PHP SDK相關配置,詳細信息,請參見前言。更多SDK及API調用示例,請參見OpenAPI

創建水印模板

調用AddWaterMarkTemplate新增水印模板,接口參數和返回字段詳細信息請參見創建水印模板,調用示例如下:

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\AddWaterMarkTemplateRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * 正式環境下 建議 protocol = "HTTPS";
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     */
    public static function main(){
        $sample = new Sample;
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new AddWaterMarkTemplateRequest([
            "name" => "test name",
            "config" => $sample->templateConfig(),
        ]);
        $response = $client->addWaterMarkTemplate($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

    function templateConfig() {
        $templateConfig['Width'] = "10";
        $templateConfig['Height'] = "30";
        $templateConfig['Dx'] = "10";
        $templateConfig['Dy'] = "5";
        $templateConfig['ReferPos'] = "TopRight";
        $templateConfig['Type'] = "Image";
        $templateConfig['Timeline'] = array('Start' => 0,
                                            'Duration' => 10);
        return json_encode($templateConfig);
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

更新水印模板

調用UpdateWaterMarkTemplate更新水印模板,接口參數和返回字段詳細信息請參見更新水印模板,調用示例如下:

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\UpdateWaterMarkTemplateRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * 正式環境下 建議 protocol = "HTTPS";
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     */
    public static function main(){
        $sample = new Sample;
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new UpdateWaterMarkTemplateRequest([
            "waterMarkTemplateId" => "81a55d41ee705e57ddbecd******",
            "name" => "update name",
            "config" => $sample->templateConfig(),
        ]);
        $response = $client->updateWaterMarkTemplate($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

    function templateConfig() {
        $templateConfig['Width'] = "10";
        $templateConfig['Height'] = "30";
        $templateConfig['Dx'] = "10";
        $templateConfig['Dy'] = "5";
        $templateConfig['ReferPos'] = "TopRight";
        $templateConfig['Type'] = "Image";
        $templateConfig['Timeline'] = array('Start' => 0,
                                            'Duration' => 10);
        return json_encode($templateConfig);
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

查詢水印模板

調用QueryWaterMarkTemplateList查詢水印模板,接口參數和返回字段詳細信息請參見查詢水印模板,調用示例如下:

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\QueryWaterMarkTemplateListRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * 正式環境下 建議 protocol = "HTTPS";
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     */
    public static function main(){
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new QueryWaterMarkTemplateListRequest([
            "waterMarkTemplateIds" => "81a55d41ee337ddbecd*******"
        ]);
        $response = $client->queryWaterMarkTemplateList($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

搜索水印模板

調用SearchWaterMarkTemplate搜索水印模板,接口參數和返回字段詳細信息請參見搜索水印模板,調用示例如下:

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\SearchWaterMarkTemplateRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * 正式環境下 建議 protocol = "HTTPS";
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     */
    public static function main(){
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new SearchWaterMarkTemplateRequest([
            "state" => "Normal"
        ]);
        $response = $client->searchWaterMarkTemplate($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

刪除水印模板

調用DeleteWaterMarkTemplate刪除水印模板,接口參數和返回字段詳細信息請參見刪除水印模板,調用示例如下:

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\DeleteWaterMarkTemplateRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * 正式環境下 建議 protocol = "HTTPS";
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     */
    public static function main(){
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new DeleteWaterMarkTemplateRequest([
            "waterMarkTemplateId" => "81a55d41ee33455e57ddbecd******"
        ]);
        $response = $client->deleteWaterMarkTemplate($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

相關文檔