Code Mode

This section shows an example on how to create a resizing style in Code mode on OBS Console.

Procedure

  1. On the homepage of the management console, choose All Services > Storage > Object Storage Service.
  2. In the bucket list, click the target bucket to go to the Overview page.
  3. In the navigation tree on the left, select Objects.
  4. Click Upload Object. The Upload Object page is then displayed.
  5. Click the red-line-marked button to open the local file browser and select files, as shown in Figure 1.

    Figure 1 Uploading an image

  6. Select the image that you want to upload and click Open.
  7. Click Upload to upload the image. The uploaded image is displayed in the object list.
  8. Click the bucket name. Select Image Processing,
  9. Click Create Style to go to the style editing page.
  10. Input the style name style002. On the editing page, select Code.
  11. In the code input box, input the following command and parameters for resizing.

    Specify a rectangle, whose w and h equal 100. Lock the aspect ratio, and obtain the smallest image in the extended area of the 100 x 100 rectangle.

    image/resize,m_mfit,h_100,w_100

    The style effect will be displayed on the right in real time. Figure 2 shows the final style effects.

    Figure 2 Style style002

  12. After finishing editing the image style, click OK to save the style. The new style style002 will be displayed in the style list,
  13. In the navigation tree on the left, select Objects. Click mountain.jpg in the object list to go to the file details page.
  14. By clicking the Preview Image tab, you can preview the effect of the current style, For details, see Figure 3.

    Figure 3 Preview Image

  15. Click Copy Link. After prompted with Copied successfully, you can obtain the access address of the image file.