Skip to content

finkinfridom/payload-cloudinary-plugin

Repository files navigation

payload-cloudinary-plugin

Extends payloadcms with Cloudinary integration

Current status

codeql

test

publish

GitHub Super-Linter

Codacy Badge

Install

yarn add payload-cloudinary-plugin

Get Started

server.ts

import { mediaManagement } from "payload-cloudinary-plugin";

app.use(mediaManagement());

payload.config.ts

import cloudinaryPlugin from "payload-cloudinary-plugin/dist/plugins";

export default buildConfig({
    ....
    plugins: [cloudinaryPlugin()]
    ....
})

mediaManagement function

function mediaManagement(
  config?: ConfigOptions,
  uploadApiOptions?: UploadApiOptions,
  uploadResourceTypeHandler?: Function
)

The function may receive a ConfigOptions and a UploadApiOptions from cloudinary package. Additionally, you can specify a uploadResourceTypeHandler to manage which resource_type parameter must be passed to cloudinary.upload (see here: https://cloudinary.com/documentation/image_upload_api_reference#upload_optional_parameters for additional information).

If the uploadResourceTypeHandler is NOT specified, resource_type: auto will be passed to upload method.