All operation parameters for transforming images will be added behind URL, so this will make the URL of images long and inconvenient for reading. The JD Cloud OSS Image Service provides a function of image style, so you can save the common used image operation as an alias, i.e. image style (IMGStyle). Even for a complex operation, after using the image style function, you can achieve the same effect with a very short URL.
There are multiple styles under one Bucket while the effect of the styles will only be taken under one Bucket.
<URL of file>?x-oss-process=imgalias/<StyleName>
Example:
bucket.s3.cn-north-1.jdcloud-oss.com/lena.jpg?x-oss-process=imgalias/stylename
This method is the default method of style access in image processing, which can be used when you only need to create a new image style on the Console
<URL of file><Delimiter><StyleName>
Example:
bucket.s3.cn-north-1.jdcloud-oss.com/lena.jpg{delimiter}stylename
**If the URL of the image is provided with a delimiter, OSS Image Service will take the content behind this delimiter as the style name. ** The delimiter will only take effect when it is configured on the Console. Support
-, _, /, !
style delimiters. Access via Delimiter is an alternative use method for image processing.
Description
StyleName means the name of image style.
Create style, delete style and modify style can be operated either on the Console or through OPENAPI.
After multiple delimiters are set, if the url contains several delimiters, image access will be subject to -
тЖТ _
тЖТ /
тЖТ!
sequence. For specific rules, please see the following example:
Example:
If the image style name set for the bucket is: imgStyle
. The request contains multiple legal delimiters, and bucket sets these delimiters, such as: http://downloads.s3.cn-north-1.jcloudcs.com/lena.jpg-imgStyle_imgStyle
. In accordance with the matching sequence -
тЖТ _
тЖТ /
тЖТ!
, the system matches -
as a delimiter. The contents after the delimiter will be the image style name, i.e. imgStyle_imgStyle
. The contents before the delimiter are the fileтАЩs url, i.e. the object key is lena.jpg
. If the bucket doesnтАЩt set a style named as imgStyle_imgStyle
, the system will consider the -
here as not used as a delimiter. The next delimiter _
set in the bucket will be matched. Also, the image style name is imgStyle
, and the object key is lena.jpg-imgStyle
. If the bucket has set a style named as imgStyle
, the match succeeds and the processing result will be returned.
Example 1: testbucket contains a file named as animal.jpg!imgStyle
, and at the same time testbucket contains the image style named as imgStyle
.
Access the file URLtestbucket.s3.cn-north-1.jdcloud-oss.com/animal.jpg!imgStyle
. If the file named as animal.jpg exists, the processed image will be returned, and if not, 404 will be returned.
Example 2: testbucket contains a file named as animal.jpg!imgStyle
, and at the same time testbucket doesnтАЩt contain the image style named as imgStyle
.
Access the file URLtestbucket.s3.cn-north-1.jdcloud-oss.com/animal.jpg!imgStyle
, and animal.jpg!imgStyle
file will be returned.
In the left bucket list of OSS Console, click the name of the bucket to which you will set a delimiter.
Click Image Processing tab to find the Image Access Setting button.
Click Image Access Setting to open the setting window.
In the setting window, you can conduct the following setting:
Original Image Protection
After opening original image protection, please refer to Original Image Protection-Original Image Protection Rules for the information you need to know.
Customized Delimiter.
After setting the option required, click OK to complete the setting of delimiter.
You can complete the setting of customized delimiter through OPENAPI.
If we create a style for the bucket downloads:
Directly access by parameter
https://downloads.s3.cn-north-1.jcloudcs.com/lena.jpg?x-oss-process=img/r/60/q/71/p/s/200/300
Access by using style through URL parameter
https://downloads.s3.cn-north-1.jdcloud-oss.com/lena.jpg?x-oss-process=imgalias/imgstyle_demo
Access by using style through style delimiter
https://downloads.s3.cn-north-1.jdcloud-oss.com/lena.jpg!imgstyle_demo
These three methods can achieve the same effect.