Updated on 2024-03-04 GMT+08:00

Code Mode

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

Procedure

  1. On the console homepage, click Service List in the upper left corner and choose Storage > Object Storage Service.
  2. In the bucket list, click the bucket you want to go to the Objects page.
  3. Click Upload Object. The Upload Object page is displayed.
  4. Click add file marked by red box in Figure 1 to open the local file browser.

    Figure 1 Uploading an image

  5. Select the image that you want to upload and click Open.
  6. Click Upload to upload the image. The uploaded image is displayed in the object list.
  7. In the navigation pane, choose Data Processing > Image Processing.
  8. Click Create. The style editing page is displayed.
  9. Input the style name style002. On the editing page, select Code.
  10. 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

  11. After finishing editing the image style, click OK to save the style. The new style style002 will be displayed in the style list.
  12. In the navigation pane, choose Objects. Click mountain.jpg in the object list to go to the file details page.
  13. Click the Preview Image tab to preview the effect of the current style. For details, see Figure 3.

    Figure 3 Preview Image

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