jorisnoo / craft-cloudinary
Cloudinary integration for Craft CMS.
Package info
github.com/jorisnoo/craft-cloudinary
Type:craft-plugin
pkg:composer/jorisnoo/craft-cloudinary
Requires
- php: >=8.2
- cloudinary/cloudinary_php: ^2.14.0
- craftcms/cms: ^4.13.0
- craftcms/flysystem: ^1.0.2
- thomasvantuycom/flysystem-cloudinary: dev-fix/silently-fail-deleting-inexistent
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
README
This plugin integrates Cloudinary with Craft CMS. Assets can be uploaded from Craft's control panel and then transformed and delivered by Cloudinary, even if stored in a different filesystem. The plugin is compatible with your existing Craft template code and named image transforms.
This is a fork of thomasvantuycom/craft-cloudinary with additional features including webhook synchronization, daily log rotation, and improved error handling.
Requirements
- Craft CMS 4.13.0 or later
- PHP 8.2 or later
Installation
composer require jorisnoo/craft-cloudinary ./craft plugin/install cloudinary
Setup
The plugin adds a Cloudinary filesystem type to Craft. It can be used solely as a transform filesystem or as a storage filesystem as well.
To create a new Cloudinary filesystem, visit Settings → Filesystems, press New filesystem, and select "Cloudinary" as the Filesystem Type. Configure your Cloud Name, API Key, and API Secret (environment variables are supported).
To start using the filesystem, visit Settings → Assets → Volumes. You can create a new volume using the Cloudinary filesystem for both storage and transforms, or add the Cloudinary filesystem to any existing volume for transforms only. In the latter case, assets with public URLs from any filesystem are transformed by Cloudinary using the fetch feature.
Image Transformations
The plugin supports all of Craft's native transform options, including mode (fit, letterbox, stretch, crop), position, quality, and format.
You can also use any of Cloudinary's transformation options in template transforms:
{% set thumb = {
width: 100,
height: 100,
quality: 75,
opacity: 33,
border: '5px_solid_rgb:999',
} %}
<img src="{{ asset.getUrl(thumb) }}">
Transformation options should be in camelCase (aspect_ratio → aspectRatio, fetch_format → fetchFormat).
Webhook Notifications
The plugin supports real-time synchronization with Cloudinary via webhooks. When assets are uploaded, deleted, renamed, or moved in Cloudinary, the changes are automatically reflected in Craft.
Setup
Go to your Cloudinary webhook settings and add a notification URL:
https://your-site.com/actions/cloudinary/notifications/process?volume={VOLUME_ID}
Replace {VOLUME_ID} with your asset volume ID.
Supported notification types
upload— creates assets in Craftdelete— removes assets from Craftrename— updates filenamesmove/move_or_rename_asset_folder— moves assets between foldersresource_display_name_changed— updates asset titlescreate_folder/delete_folder— manages folder structure
Security
Webhook requests are verified using Cloudinary's HMAC-SHA1 signature (via X-Cld-Signature and X-Cld-Timestamp headers). Signatures older than 2 hours are rejected.
Console Commands
# Trigger a full asset volume sync php craft cloudinary/trigger-asset-sync/sync {volumeId} # Scan and fix public IDs that contain folder paths php craft cloudinary/remove-paths-from-public-ids/scan {volumeId}
Logging
The plugin logs to storage/logs/cloudinary-YYYY-MM-DD.log with daily rotation (30 days retained, 10MB max per file). Sensitive data (API keys, signatures) is automatically masked in logs.