Applying Image Styles

When a created image style exists in a bucket, use either of the following methods to apply the image style:

  • Copying Link: On OBS console, obtain the image URL when previewing the image on the details page. Enter the URL in the address bar of a browser, and you can obtain the processed image. Copying Links shows the detailed procedure.
  • Concatenating domain names: Concatenate a domain name by referring to the following rule, enter it in the address bar of a browser, and obtain the processed image.
    <Image URL>?x-image-process=style/<Style name>

    Obtain the image URL from the object details page. For details, see Editing Domain Names.

Copying Links

  1. On the homepage of the management console, choose All Services > Storage > Object Storage Service.
  2. Select the bucket that houses the style. In the navigation tree on the left, select Objects.
  3. Click an existing file name or upload a new image, and go to the file details page.
  4. By clicking the Preview Image tab, you can preview the image effect in different styles. For details, see Figure 1.

    Figure 1 Preview Image

  5. Click Copy Link. After prompted with Copied successfully, you can obtain the address of the image that uses styles and then access the image in the browser.

Editing Domain Names

  1. On the OBS object list page, click an image to be processed. The image details page is displayed.
  2. Choose Object ACL > Public Permissions > Anonymous User, click Edit to authorize the object read permission to the anonymous user, and click Save. For details, see Figure 2.

    Figure 2 Authorizing the object read permission to anonymous users

  3. Click the icon next to the link to copy the image URL.
  4. Add ?x-image-process=style/<Style name> behind the copied URL. Enter it in the address bar of a browser, and then you can access the processed image.

    Example:

    https://bucketname.obs.cn-north-4.myhuaweicloud.com/example.jpg?x-image-process=style/stylename

    The preceding image links and styles are examples for reference only. Change accordingly in practice.