Tutorial Sections:
- Use cases for named transformations
- Creating a named transformation using the API
- Naming a transformation set in the Media Library
- Applying a named transformation to an image or video
- Setting a named transformation as a template
Named transformations are a very useful feature, allowing for you to take a set of transformations for your images and/or videos and include them all by simply using the named transformation.
Use cases for named transformations
While there are many use cases for naming your Cloudinary transformation sets, here are the most common reasons to do so:
Shortening your URLs
Sometimes users have a large filename/public ID with a folder name that has many characters. Compound that with long sequences of transformations and your URLs can get very lengthy, which can make it cumbersome for sharing with others. Naming the transformation set will essentially shorten it to one transformation in the URL structure, vastly reducing the original size.
Preventing human error
When applying transformations to an image or video, it can be easy to forget to add one or more in the process. For example, if you wish to apply the transformations ar_1:1,bo_5px_solid_rgb:caa5c9,c_fill,f_webp,fl_awebp,g_face/f_jpg,g_south_east,l_samples:cloudinary-icon/
to an image, you are relying on being able to repeatedly apply them without any spelling or syntax errors. To help prevent human error in the process, you can group these parameters into one named transformation.
Adding confidentiality and security
Naming a transformation set hides the original transformation details from the URL. With a name like “t_global” for example, the details of exactly which transformations are being used are obscured.
This image is the same as this image, however the former lists all its transformations in its overly long URL, while the latter is much shorter and concealed.
Go back to the top of the article.
Creating a named transformation using the API
It's possible to create a named transformation using our Admin API. You can do so in two ways.
The first is by sending a POST request with the following syntax:
POST /transformations/:name
The second is to use any of our SDKs and use the create_transformation
method in order to create and name your transformation.
For more information on this, including syntax, please refer to our Admin API documentation.
Go back to the top of the article.
Naming a transformation set in the Media Library
To create a named transformation:
1. Log into your Cloudinary Management Console.
2. Access your Transformation Center by selecting it from the lefthand navigation bar.
3. Click the "New Transformation" button in the top right corner.
4. Individually add transformations on the lefthand side, or click "Quick Edit" towards the bottom right of this page to copy and paste the string of transformations you'd like to use.
Go back to the top of the article.
Applying a named transformation to an image or video
After developing a named transformation, you can apply it to any image or video in your Cloudinary Media Library as you would with any other transformations. Simply use the “t_” parameter and then the name of the transformation, i.e. “t_global”. Remember that transformations commonly go directly before the public ID in the URL structure.
Go back to the top of the article.
Setting a named transformation as a template
You can also add any named transformation as a template by clicking "Manage Transformations" in the lefthand navigation bar, finding your named transformation, and clicking the 3 dot icon which will allow you to designate the transformation as a template for images and/or videos.
After doing so, you can see the named transformation in the detailed view of any asset when you click the "Open" icon for that asset.
For further details on named transformations, please review our official developer documentation and Knowledge Base, as well as this informative blog post from our friend David Walsh.
Go back to the top of the article.
Comments
4 comments
How can I create an overlay transformation of text?
Hey Laura, thanks for reaching out!
Text overlay can be easily added via the UI, by setting an overlay with the "text:" keyword, followed by the text options -
You can check the available options in our text overlay guide -
https://cloudinary.com/documentation/image_transformations#adding_text_captions
Hope this helps!
Hi all, is it possible to display different transformation presets for different users or user groups?
Hi Marvin,
You can select the various presets you want to display when you click on an asset but right now we cannot display different transformations for different users.
Please sign in to leave a comment.