Adding all the changes to the image after the URL makes the URL too long and inconvenient for management and reading. IMG allows you to save common operations as an alias, that is, a style. With the style, a complicated operation can be performed through a short URL.
Multiple styles (50 at most) are grouped under a bucket. Each style is effective only within the bucket.
Style access rules
<File URL>? x-oss-process=style/<StyleName>
This is the default style access method supported by IMG.
IMG regards the content after the separator in a URL as the style name. This is an
optional method provided by IMG. You must set separators in the console. Separators
! are supported.
- StyleNameindicates the name of a style.
- Style creations, deletions, and modifications are all performed in the console.
- When the requested style does not exist in the specified bucket, the system returns the error NotSuchStyle.
- In the left-side bucket list of the OSS console, click the bucket to which you want to set separators.
- Click the Image Processing tab, and then click Access Settings. As shown in the following figure:
- In the Access Settings dialog box, set the following parameters:
- Source Image Protection: After enabling the original image protection, you can only access the image file by passing in the StyleName or using a signature-based method. Direct accesses to the OSS original file or accesses by passing in image parameters and modifying the image style are not allowed.
- Customize separator
In this example, a style is created in the bucket image-demo.
|Style name||Style content|
- Access through parameters
- Access through URL parameters in style mode
- Access through style separators in style mode
These three methods bring the same result.