tencent cloud

Feedback

Guetzli Compression

Last updated: 2022-04-06 16:53:38

    Overview

    This document provides an overview of APIs and SDK code samples related to Guetzli compression.

    API Description
    Enabling Guetzli compression Enables the Guetzli compression feature for a bucket
    Querying the Guetzli status Queries whether the Guetzli compression feature is enabled
    Disabling Guetzli compression Disables the Guetzli compression feature

    Enabling Guetzli Compression

    Description

    This API is used to enable the Guetzli compression feature for a bucket.

    Sample code

    <?php
    require dirname(__FILE__) . '/../vendor/autoload.php';
    $secretId = "SECRETID"; //Replace it with the actual SecretId, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $secretKey = "SECRETKEY"; //Replace it with the actual SecretKey, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $region = "ap-beijing"; //Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket
    $cosClient = new Qcloud\Cos\Client(
      array(
          'region' => $region,
          'schema' => 'https', // Protocol header, which is http by default
          'credentials'=> array(
              'secretId'  => $secretId ,
              'secretKey' => $secretKey)));
    try {
          $result = $cosClient->PutBucketGuetzli(array(
          'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-APPID`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
      ));
      // Request succeeded
      print_r($result);
    } catch (\Exception $e) {
      // Request failed
      echo($e);
    }
    

    Parameter description

    Parameter Type Description Required
    Bucket String Bucket name in the format of BucketName-APPID Yes

    Sample response

    Guzzle\Service\Resource\Model Object
    (
      [structure:protected] => 
      [data:protected] => Array
          (
              [RequestId] => NWQwOGRkNDdfMjJiMjU4NjRfNzVjXzEwNmVjY2M=
              [Bucket] => examplebucket-1250000000
              [Location] => examplebucket-1250000000.pic.ap-beijing.myqcloud.com/
          )
    )
    

    Response description

    Parameter Type Description Parent Node
    RequestId String Request ID None
    Bucket String Bucket name in the format of BucketName-APPID None
    Location String Address of the requested resource None

    Querying the Guetzli Status

    Description

    This API is used to query whether the Guetzli compression feature is enabled.

    Sample code

    <?php
    require dirname(__FILE__) . '/../vendor/autoload.php';
    $secretId = "SECRETID"; //Replace it with the actual SecretId, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $secretKey = "SECRETKEY"; //Replace it with the actual SecretKey, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $region = "ap-beijing"; //Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket
    $cosClient = new Qcloud\Cos\Client(
      array(
          'region' => $region,
          'schema' => 'https', // Protocol header, which is http by default
          'credentials'=> array(
              'secretId'  => $secretId ,
              'secretKey' => $secretKey)));
    try {
          $result = $cosClient->GetBucketGuetzli(array(
          'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-APPID`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
      ));
      // Request succeeded
      print_r($result);
    } catch (\Exception $e) {
      // Request failed
      echo($e);
    }
    

    Parameter description

    Parameter Type Description Required
    Bucket String Bucket name in the format of BucketName-APPID Yes

    Sample response

    Guzzle\Service\Resource\Model Object
    (
      [structure:protected] => 
      [data:protected] => Array
          (
              [RequestId] => NWQwOGRkNDdfMjJiMjU4NjRfNzVjXzEwNmVjY2M=
              [Bucket] => examplebucket-1250000000
              [Location] => examplebucket-1250000000.pic.ap-beijing.myqcloud.com/
              [GuetzliStatus] => on
          )
    )
    

    Response description

    Parameter Type Description Parent Node
    RequestId String Request ID None
    Bucket String Bucket name in the format of BucketName-APPID None
    Location String Address of the requested resource None
    GuetzliStatus String Guetzli status. on: enabled. off: disabled None

    Disabling Guetzli Compression

    This API is used to disable the Guetzli compression feature.

    Sample code

    <?php
    require dirname(__FILE__) . '/../vendor/autoload.php';
    $secretId = "SECRETID"; //Replace it with the actual SecretId, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $secretKey = "SECRETKEY"; //Replace it with the actual SecretKey, which can be viewed and managed at https://console.tencentcloud.com/cam/capi
    $region = "ap-beijing"; //Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket
    $cosClient = new Qcloud\Cos\Client(
      array(
          'region' => $region,
          'schema' => 'https', // Protocol header, which is http by default
          'credentials'=> array(
              'secretId'  => $secretId ,
              'secretKey' => $secretKey)));
              
    try {
          $result = $cosClient->DeleteBucketGuetzli(array(
          'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-APPID`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
      ));
      // Request succeeded
      print_r($result);
    } catch (\Exception $e) {
      // Request failed
      echo($e);
    }
    

    Parameter description

    Parameter Type Description Required
    Bucket String Bucket name in the format of BucketName-APPID Yes

    Sample response

    Guzzle\Service\Resource\Model Object
    (
      [structure:protected] => 
      [data:protected] => Array
          (
              [RequestId] => NWQwOGRkNDdfMjJiMjU4NjRfNzVjXzEwNmVjY2M=
              [Bucket] => examplebucket-1250000000
              [Location] => examplebucket-1250000000.pic.ap-beijing.myqcloud.com/
          )
    )
    
    Response description
    Parameter Type Description Parent Node
    RequestId String Request ID None
    Bucket String Bucket name in the format of BucketName-APPID None
    Location String Address of the requested resource None
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support