Aller au contenu

@studiocms/cloudinary-image-service

Ce module d’extension active le service d’images de Cloudinary pour StudioCMS

  1. Installez le paquet à l’aide de la commande suivante :

    Fenêtre de terminal
    npm run studiocms add @studiocms/cloudinary-image-service
  2. Votre configuration StudioCMS doit désormais inclure @studiocms/cloudinary-image-service :

    studiocms.config.mjs
    import {
    function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

    A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

    StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

    Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

    @example

    // studiocms.config.mjs
    import { defineStudioCMSConfig } from 'studiocms/config';
    export default defineStudioCMSConfig({
    dbStartPage: true,
    // ...Other Options
    })

    defineStudioCMSConfig
    } from 'studiocms/config';
    import
    function cloudinaryJS(): StudioCMSPlugin

    Cloudinary Image Service

    This plugin is used to generate Cloudinary URLs for images using @cloudinary/url-gen for StudioCMS.

    cloudinaryJS
    from '@studiocms/cloudinary-image-service';
    export default
    function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

    A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

    StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

    Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

    @example

    // studiocms.config.mjs
    import { defineStudioCMSConfig } from 'studiocms/config';
    export default defineStudioCMSConfig({
    dbStartPage: true,
    // ...Other Options
    })

    defineStudioCMSConfig
    ({
    StudioCMSOptions.plugins?: StudioCMSPlugin[]

    Add Plugins to the StudioCMS

    plugins
    : [
    function cloudinaryJS(): StudioCMSPlugin

    Cloudinary Image Service

    This plugin is used to generate Cloudinary URLs for images using @cloudinary/url-gen for StudioCMS.

    cloudinaryJS
    (),
    ],
    });
  3. Définissez les variables d’environnement requises

    .env
    CMS_CLOUDINARY_CLOUDNAME="demo"

Pour activer le service d’image, vous devez définir le paramètre preferredImageService sur cloudinary-js.

studiocms.config.mjs
import {
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
} from 'studiocms/config';
import
function cloudinaryJS(): StudioCMSPlugin

Cloudinary Image Service

This plugin is used to generate Cloudinary URLs for images using @cloudinary/url-gen for StudioCMS.

cloudinaryJS
from '@studiocms/cloudinary-image-service';
export default
function defineStudioCMSConfig(config: StudioCMSOptions): StudioCMSOptions

A utility function to define the StudioCMS config object. This function is used to define the optional StudioCMS config object in the Astro project root. The expected file name is studiocms.config.mjs. And it should be adjacent to the Astro project's astro.config.mjs file.

StudioCMS will attempt to import this file and use the default export as the StudioCMS config object automatically if it exists.

Using this function is optional, but it can be useful for IDEs to provide better intellisense and type checking.

@example

// studiocms.config.mjs
import { defineStudioCMSConfig } from 'studiocms/config';
export default defineStudioCMSConfig({
dbStartPage: true,
// ...Other Options
})

defineStudioCMSConfig
({
StudioCMSOptions.features?: FeaturesConfig

Allows adjusting the StudioCMS Dashboard features

features
: {
FeaturesConfig.preferredImageService?: string

Set the identifier of the Preferred Image Service

Requires an Image Service to be installed such as 'cloudinary-js'

preferredImageService
: 'cloudinary-js'
},
StudioCMSOptions.plugins?: StudioCMSPlugin[]

Add Plugins to the StudioCMS

plugins
: [
function cloudinaryJS(): StudioCMSPlugin

Cloudinary Image Service

This plugin is used to generate Cloudinary URLs for images using @cloudinary/url-gen for StudioCMS.

cloudinaryJS
(),
],
});