decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.7k stars 3.03k forks source link

Add option for the image widget to return object instead of URL #6998

Open martinjagodic opened 7 months ago

martinjagodic commented 7 months ago

Is your feature request related to a problem? Please describe. The image widget returns a string (URL) or an array of strings if multiple: true. On Cloudinary you can have much more data from that image, but we can't get that to the CMS.

Describe the solution you'd like I would like to see an option to return an object that would return also some metadata about the image. I am mostly interested in alt and title, but other fields could be added too.

Example

{label: Featured Image, name: image, widget: image, media_library: {config: {
  multiple: true,
  return_object: true
}}},

another option would be to add more control - let's say we define an array of fields that we want returned

{label: Featured Image, name: image, widget: image, media_library: {config: {
  return_fields: [url, title, alt, created_at]
}}},

Describe alternatives you've considered Now you have to create your own object with alt and title fields, and that could mean double work and double data.