0

Here is the relevant portion of my config.yml for NetlifyCMS where I want to use Uploadcare's image widget to select multiple images for a gallery:

media_library:
  name: uploadcare
  config:
    publickey: mypublicapikey
media_folder: "/src/images/"
public_folder: "/src/images/"
collections:
  - label: "Projects" 
    name: "projects" 
    folder: "src/data/projects" 
    media_folder: 'images' 
    media_library:
      name: uploadcare
      config:
        publickey: mypublicapikey
    fields: # The fields for each document, usually in front matter
      - {label: "Image", name: "image", widget: "image", allow_multiple: false}
      - label: "Gallery Images"
        name: "images"
        widget: "image"
        options:
          media_library:
            config:
              multiple: true
              previewStep: false

This results in a widget where I can only select one image. I have tried shift/ctrl/ctrl+shift clicking additional entries but it doesn't work. The docs say allowing for multiple images is the default, but this is not the behavior I am experiencing.

Casey
  • 444
  • 1
  • 7
  • 22

1 Answers1

0

To get Uploadcare working, you may need to install the uploadcare plugin for netlify-cms:

npm i netlify-cms-media-library-uploadcare --save

I followed the solution posted here, to break it down:

  1. Create a cms folder in src
  2. Add a cms.js file to the src/cms folder
  3. Add this code:
import CMS from 'netlify-cms-app'
import uploadcare from 'netlify-cms-media-library-uploadcare';

CMS.registerMediaLibrary(uploadcare);

Then follow the docs for Uploadcare.

Casey
  • 444
  • 1
  • 7
  • 22
  • Currently the Uploadcare API doesn't work with the current version of NetlifyCMS. You may run into this error: `TypeError: Cannot convert object to primitive value` I contacted Uploadcare and their team is working on it. For now, they recommended downgrading NetlifyCMS to 2.9.7. – Casey Jan 24 '20 at 17:25