decaporg / decaporg/decap-cms

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

Open
#6,998 0 comments 0 reactions 0 assignees View on GitHub
area: extensions/widgets/image type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**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
```yaml
{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
```yaml
{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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.