What is your developer-dependent CMS actually costing you? Calculate your costs and get a full report
What is your developer-dependent CMS actually costing you? Calculate your costs and get a full report
Marketplace Apps
Connect your Cloudinary assets with Agility
The Cloudinary App for Agility lets editors search, select and attach Cloudinary resources — images and videos — to their content, without leaving the content form.
Cloudinary is an amazing tool to help you unleash the full potential of your online media. Optimize, transform, and combine your images to create great digital experiences. Upload and stream high quality adaptive videos from your website.
The field stores Cloudinary’s own asset metadata as JSON, so your front end can hand the public_id straight to any Cloudinary SDK and get delivery, transformation and optimisation for free.
Shows a preview of the attached image alongside its Cloudinary public ID, type, size and URL. The alt text box writes to the asset’s Cloudinary metadata, so it travels with the value to your front end.

The same, for video. The attached video plays inline so an editor can confirm they picked the right one.

Click Browse (or Change, when something is already attached) and Cloudinary’s own Media Library opens inside Agility — search, folders, tags, upload and the transformation editor, exactly as your team knows them. The field filters the library to the right resource type, so an image field only offers images.

The first time an editor opens the browser they are asked to sign in to Cloudinary, or are passed through your Cloudinary SSO. That is Cloudinary’s own authentication, and it is what scopes what they can see and upload.
In order to use this integration, some set up is required.
Log in to the Cloudinary console. Take note of the Cloud name and API Key from the main dashboard. You do not need the API Secret, and you should not paste it into the app.
Install the app from the Settings > Apps section of Agility, then fill in its two configuration values:
Until both are filled in, the fields show a “Cloudinary is not configured yet” notice naming what is missing.
In order to use Cloudinary fields, you need to have Content Models or Page Modules in Agility CMS that utilize these new field types.
Next, create some content using your Content Model.
Now that you have set up the field and allowed editors to reference assets from Cloudinary, the next thing you will need to do is actually output these fields in your digital solution (i.e. website or app).
The value of an Image or Video Cloudinary field is a JSON string returned from the Content Fetch or GraphQL API. Parse it to an object with JSON.parse(value) before reading it. An empty field is an empty string, so guard for that first — JSON.parse("") throws.
{
"public_id": "pexels-juan-salamanca-61143_o51ss6",
"resource_type": "image",
"type": "upload",
"format": "jpg",
"version": 1623349590,
"width": 5184,
"height": 3456,
"bytes": 1992294,
"created_at": "2021-06-10T18:26:30Z",
"secure_url": "https://res.cloudinary.com/agility-cms/image/upload/v1623349590/grass.jpg",
"url": "http://res.cloudinary.com/agility-cms/image/upload/v1623349590/grass.jpg",
"tags": [],
// alt text typed in the field lives here
"context": { "custom": { "alt": "This is a grass field" } },
// present ONLY when a transformation was chosen. This is an ARRAY.
"derived": [
{
"raw_transformation": "c_fill,h_600,w_1200",
"secure_url": "https://res.cloudinary.com/agility-cms/image/upload/c_fill,h_600,w_1200/v1623349590/grass.jpg"
}
]
}A few things worth knowing:
With no Cloudinary SDK at all — take the URL the editor saw:
const asset = JSON.parse(item.fields.heroImage)
const src = asset.derived?.[0]?.secure_url ?? asset.secure_url
<img
src={src}
alt={asset.context?.custom?.alt ?? ""}
width={asset.width}
height={asset.height}
/>Or apply your own transformations from the public_id, using Cloudinary’s current React SDK:
import { Cloudinary } from "@cloudinary/url-gen"
import { AdvancedImage } from "@cloudinary/react"
import { fill } from "@cloudinary/url-gen/actions/resize"
const cld = new Cloudinary({ cloud: { cloudName: "agility-cms" } })
const asset = JSON.parse(item.fields.heroImage)
<AdvancedImage
cldImg={cld.image(asset.public_id).resize(fill().width(1200).height(600))}
alt={asset.context?.custom?.alt ?? ""}
/>Video, with the browser’s own player:
const video = JSON.parse(item.fields.promoVideo)
<video
src={video.secure_url}
controls
playsInline
width={video.width}
height={video.height}
/>Cloudinary builds and maintains front-end SDKs to assist with rendering images and videos, complete with handling transformations and much more.
The app is open source (MIT) at github.com/agility/agility-cms-app-cloudinary.