# payload-cloudinary-plugin
Extends payloadcms with Cloudinary integration
Current status
Install
yarn add payload-cloudinary-plugin
Get Started
Set cloudinary environment variables
CLOUDINARY_CLOUD_NAME=<your cloud name>
CLOUDINARY_API_KEY=<your api key>
CLOUDINARY_API_SECRET=<your api secret>
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.
