Skip to content
KeystoneJS LogoKeystoneJS

CloudinaryImage

Upload an image to Cloudinary.

Usage

Import the field from the @keystonejs/file-adapters package and configure it:

JS
const { CloudinaryAdapter } = require('@keystonejs/file-adapters');

const cloudinaryAdapter = new CloudinaryAdapter({
  cloudName: process.env.CLOUDINARY_CLOUD_NAME,
  apiKey: process.env.CLOUDINARY_KEY,
  apiSecret: process.env.CLOUDINARY_SECRET,
  folder: 'my-keystone-app',
});

Then when creating your list, use the field as so:

JS
const { CloudinaryImage } = require('@keystonejs/fields');

keystone.createList('Item', {
  fields: {
    image: { type: CloudinaryImage, adapter: cloudinaryAdapter },
  },
});

On this page

  • Usage
Edit on GitHub