CloudinaryMade by Strapi
Cloudinary provider for Strapi uploads
@strapi/provider-upload-cloudinary
Resources
Links
Installation
# using yarn
yarn add @strapi/provider-upload-cloudinary
# using npm
npm install @strapi/provider-upload-cloudinary --save
Configuration
provider
defines the name of the providerproviderOptions
is passed down during the construction of the provider. (ex:cloudinary.config
). Complete list of optionsactionOptions
is passed directly to each method respectively allowing for custom options. You can find the complete list of upload/ uploadStream options and delete options
See the documentation about using a provider for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the documentation about environment variables.
Provider Configuration
./config/plugins.js
1module.exports = ({ env }) => ({
2 // ...
3 upload: {
4 config: {
5 provider: 'cloudinary',
6 providerOptions: {
7 cloud_name: env('CLOUDINARY_NAME'),
8 api_key: env('CLOUDINARY_KEY'),
9 api_secret: env('CLOUDINARY_SECRET'),
10 },
11 actionOptions: {
12 upload: {},
13 uploadStream: {},
14 delete: {},
15 },
16 },
17 },
18 // ...
19});
Security Middleware Configuration
Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy
settings to properly see thumbnail previews in the Media Library. You should replace strapi::security
string with the object bellow instead as explained in the middleware configuration documentation.
./config/middlewares.js
1module.exports = [
2 // ...
3 {
4 name: 'strapi::security',
5 config: {
6 contentSecurityPolicy: {
7 useDefaults: true,
8 directives: {
9 'connect-src': ["'self'", 'https:'],
10 'img-src': ["'self'", 'data:', 'blob:', 'market-assets.strapi.io', 'res.cloudinary.com'],
11 'media-src': [
12 "'self'",
13 'data:',
14 'blob:',
15 'market-assets.strapi.io',
16 'res.cloudinary.com',
17 ],
18 upgradeInsecureRequests: null,
19 },
20 },
21 },
22 },
23 // ...
24];
Install now
npm install @strapi/provider-upload-cloudinary
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.