Saltearse al contenido

@studiocms/cloudinary-image-service

Este plugin habilita el servicio de imágenes Cloudinary para StudioCMS.

  1. Instala el paquete usando el siguiente comando:

    Ventana de terminal
    npm run studiocms add @studiocms/cloudinary-image-service
  2. Tu configuración de StudioCMS ahora debería incluir @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. Define las variables de entorno requeridas:

    .env
    CMS_CLOUDINARY_CLOUDNAME="demo"

Para habilitar el servicio de imágenes, debes establecer la configuración preferredImageService en 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
(),
],
});