Image Processor first steps
To configure Image Processor, follow the steps below:
- Access Azion Console > Edge Application.
- Select the edge application responsible for managing your images from your list of existing applications or add a new one with the help of the getting started guide.
- In the Cache Settings tab, add or edit a custom cache policy for your images.
- In the Cache Expiration Policies section, configure the expiration policy for your images.
- In the Advanced Cache Key section, choose one of the following options:
- Content varies by some Query String fields (Allowlist): if you want to list all the fields in the Query String that will identify your images. Image Processor uses the ims field, so this has to be included in the list as one of the required fields for your image manager application. For this, you must enable the Application Accelerator module.
- Content varies by Query String, except for some fields (Blocklist): if you only want to list those fields in the Query String that should be ignored to identify the objects in your cache. In this case, it guarantees that the ims field will be removed from the list. For this, you must enable the Application Accelerator module.
- Content varies by all Query String fields: if you don’t know or aren’t sure about which fields to list in the Query String because you aren’t responsible for all the content in the cache or don’t have Application Accelerator activated.
- Edit the remaining settings as required and click the Save button.
- In the Rules Engine tab for the edge application, add or edit a Request phase rule for one or more image paths.
- In the Criteria section, select the variable to indicate the path of your images in your origin:
- If
${request_uri}
matches\.(jpg|jpeg|gif|bmp|png)
Or: - If
${uri}
matches\.(jpg|jpeg|gif|bmp|png)$
- If
- In the Behavior section, select Set Cache Policy and select the cache setting you created.
- Add the Optimize Images behavior.
- Click the Save button to save your rule.
- Access Real-Time Manager (RTM).
- On the upper-left corner of the page, select Products menu > Edge Application.
- Select the edge application responsible for managing your images from your list of existing applications or add a new one with the help of the getting started guide.
- In the Cache Settings tab, add or edit a custom cache policy for your images.
- In the Expiration Settings section, configure the expiration policy for your images.
- In the Advanced Cache Key section, choose one of the following options:
- Content varies by some Query String fields (Whitelist): if you want to list all the fields in the Query String that will identify your images. Image Processor uses the ims field, so this has to be included in the list as one of the required fields for your image manager application. For this, you must enable the Application Accelerator module.
- Content varies by Query String, except for some fields (Blacklist): if you only want to list those fields in the Query String that should be ignored to identify the objects in your cache. In this case, it guarantees that the ims field will be removed from the list. For this, you must enable the Application Accelerator module.
- Content varies by all Query String fields: if you don’t know or aren’t sure about which fields to list in the Query String because you aren’t responsible for all the content in the cache or don’t have Application Accelerator activated.
- Edit the remaining settings as required and click the Save button.
- In the Rules Engine tab for the edge application, add or edit a Request rule for one or more image paths.
- In the Criteria section, select the variable to indicate the path of your images in your origin:
- If
${request_uri}
matches\.(jpg|jpeg|gif|bmp|png)
Or: - If
${uri}
matches\.(jpg|jpeg|gif|bmp|png)$
- If
- In the Behavior section, select Set Cache Policy and select the cache setting you created.
- Add the Optimize Images behavior.
- Click the Save button to save your rule.
From this point on, images from the configured path will be automatically processed.
To resize, crop, optimize, convert, or apply filters to an image, you’ll need to append the queries described in the Image Processor page to the image’s URL, which you may do using an edge function. To see the original file, you only need to remove the query string added to the URL.
To confirm whether your image is being optimized, inspect the page using your browser and find the corresponding path in the image. In the URL’s query string, the ims=VALUExVALUE
field corresponds to the resolution loaded on the page.
In addition, Image Processor detects the browser’s compatibility with WEBP format and, when possible, it’ll convert the image format automatically. BMP images will also be automatically converted to JPEG or WEBP, depending on the browser’s compatibility.