Use query string parameters to apply transformations
The IMQuery transformation lets you control which transformations are possible using the IMQuery string. This is particularly useful if you want to allow a creative team to apply certain transformations without giving them access to your Image and Video Manager policies.
Example of the impact on images
Here is an example of an image before and after a query string parameter was applied to change the background color to green.
https://www.akalunch.com/sandwichspecial/ham.png?im=BackgroundColor=abab50
Original image:
With the query string parameter applied:
Before you begin, you should know the URL of the image you are adding the watermark to, for example,
https://www.akalunch.com/sandwichspecial/ham.png.
How to
Add IMQuery to your policy
-
Log in to Akamai Control Center, then go to ☰ > CDN > Image and Video Manager.
-
Select the correct Contract from the list.
-
Create a new policy:
- Click +Create, then click Policy on the menu that appears
- Select the policy set to which you wish to add the new policy
- Give your new policy a name, for example, "imquery_background"
- Click Create
The Image Policy Editor opens.
-
Expand the list of Transformations by clicking +.
-
Click IMQuery.
-
Configure the settings as follows:
-
Query Parameter Variable. Select the default variable im or select Add Variable from the list to enter your own variable.
-
Allowed Transformations. Select only Background Color.
-
-
Click Save and Test on Staging.
Add the IMQuery string parameter to an image URL
Now that you have configured the imquery-background policy to include the IMQuery transformation, you can control the background color of our image simply by changing the IMQuery string parameter.
To change the background color of the image to green, append the IMQuery string parameter ?im=BackgroundColor=abab50 to the URL:
https://www.akalunch.com/sandwichspecial/ham.png?im=Resize=(200,200);BackgroundColor=abab50
To change the background color to blue, change the string parameter to "?im=BackgroundColor=507eab"
Updated over 1 year ago