Seamlessly integrate Cloudinary with Payload CMS for professional media asset management. This plugin enables direct uploading your media files to Cloudinary's powerful platform.
Add the plugin to your payload config as follows. Specify the slugs of all upload collections you want to integrate with Cloudinary in the uploadCollections
option.
plugins: [
payloadCloudinaryPlugin({
uploadCollections: ['images', 'videos'],
credentials: {
apiKey: process.env.CLOUDINARY_API_KEY!,
apiSecret: process.env.CLOUDINARY_API_SECRET!,
},
cloudinary: {
cloudName: process.env.CLOUDINARY_CLOUD_NAME!,
},
}),
]
These are the minimum required plugin options. See the Additional plugin options section for further options.
The plugin automatically adds all necessary fields and hooks to the collections specified in the uploadCollections
option.
If you need to extend the collection with additional fields (e.g. an alt field), you can do so:
import { CollectionConfig } from 'payload'
export const Images: CollectionConfig = {
slug: 'images',
labels: {
singular: 'Image',
plural: 'Images',
},
upload: {
mimeTypes: ['image/*'],
},
fields: [
// The other fields are automatically added by the plugin.
{
name: 'alt',
type: 'text',
},
],
}
The following options are optional:
-
uploadOptions
-
useFilename
: Whether to use the filename of the uploaded file as the public ID. Defaults tofalse
. -
chunkSize
: The size of the chunks to upload the file in.
-
-
cloudinary
-
folder
: The folder to upload the files to.
-
See the CloudinaryPluginConfig type for more details.
⚠️ Warning: This plugin is actively evolving and may undergo significant changes. While it is functional, please thoroughly test before using in production environments.
Have a suggestion for the plugin? Any feedback is welcome!
We welcome contributions! Please open an issue to report bugs or suggest improvements, or submit a pull request with your changes.