🧝in 1.9.2-alpha

Cloudinary

This provides some shortcodes and filters for generating Cloudinary URLs.

Usage

Since the shortcodes this plugin provides are pretty generically named, it’s recommended that you namespace them:

conf.namespace('cl_', () => {
conf.addPlugin(cloudinary)
})

Now you have access to the shortcodes and filters that this plugin provides!

This plugin will try hard to extract public IDs and other information from Cloudinary URLs or segments of those URLs, but it will choke if you give it a Cloudinary URL that already has transforms in it.

Configuration

The plugin accepts several configuration options.

Public IDs

When you upload a file to Cloudinary, it is given (either explicitly or automatically) a public ID, which is how it can be identified by the API. A full discussion of public IDs is obviously beyond the scope of this document, so you are encouraged to read Cloudinary’s documentation on public IDs.

The (generally) first argument passed to a shortcode or filter in this plugin is the public ID. Frequently this looks like a filename, i.e. image.jpg but depending on how your images were uploaded to Cloudinary it may look different.

This plugin does not actually use the API to retrieve an asset record and generate a URL–if it did, you’d swamp Cloudinary with API requests on every build. It’s mostly just concatenating strings in the appropriate format to use the Transformation URL API. In many cases, image.jpg is not actually the public ID of your asset: The public ID is image and the .jpg extension just tells the URL API to serve that asset as a JPEG.

In most cases, you can use a URL for your asset and it will “just work,” but if things go sideways it can be helpful to know what’s going on behind the scenes. If you feel lik you’ve encountered a bug in this plugin, please file a bug report.