This might be one of the lesser-known features of Cloudinary, but a great one. Cloudinary has the option to use values of context variables within image transformations.
This might come in handy especially if you want to create one transformation for your images, and still, keep it dynamic enough so it would be based on the current image that is shown.
Using user based variables, it's possible to have the transformation access the image's metadata and describe the content of the image without changing the transformation itself.
The "ctx" label is used to denote that the information for the transformation should be taken from the context of the image and then use the regular method of assigning variables to the image as described in the link above.
For example, the below two images have the "label" metadata configured which describes the content of the image. The first one has the label set to "Chocolate", while the other has the label set to "Candy".
Chocolate
Candy
Notice that both examples are applied with the exact same transformation!
This can also come in handy to denote that items are in sale:
Comments
0 comments
Please sign in to leave a comment.