The IMQuery transformation allows you and your web developers to apply artistic transformations to images quickly and dynamically without having to create multiple policies, or update a policy for every change. You can add or remove transformations by typing in a different query string in the image URL. This means developers in your organization do not need access to Image and Video Manager to transform images. They can do all the image manipulation they need to do on a per image basis through the image URL. Administrators with access to Image and Video Manager can decide which transformations are possible through the image URL.
For more information review the Control Image Transformations Using a Query String recipe in the Image and Video Manager Cookbook. This recipe shows how designers can apply the transformations included in an IMQuery by typing in a different query string in the image URL.
- Add the IMQuery transformation to your policy by selecting the plus sign next to Transformations in the Workflow section.
- Select the IMQuery transformation.
- Leave the default variable of 'im' in the Query Parameter field to allow developers to specify that variable with the transformations they want to use in the query string. You can also select Add Variable and enter your own variable.
- Select the transformations that can be used through the query string. For example, if you want to use a query string to crop images in various ways, you would select only Crop, Face Crop, Feature Crop, and Region Of Interest Crop in the Allowed Transformations section. Then developers can use a query string to do custom cropping on their web pages, but they cannot use any transformations other than the ones you specified.
Now developers can use the following syntax to crop an image to specific dimensions:
For a complete list of the syntax and examples for all transformations using IMQuery, see Syntax and Examples.
If you added Resize and BackgroundColor in the Allowed Transformations section, developers would use this syntax to make changes to the image URL:
If you want to change the Background Color to green and resize the image to 300x300 pixels, that’s just as simple as changing the IMQuery transformation to:
Here's your image after you apply the Resize and Background transformations:
If you don’t want to change the Background Color you simply do not add it to the query:
Here's your image after you apply only the Resize transformation: