New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Image field #415

Closed
eduardoboucas opened this Issue Apr 18, 2018 · 11 comments

Comments

Projects
None yet
4 participants
@eduardoboucas
Copy link
Member

eduardoboucas commented Apr 18, 2018

The current method for referencing an image is as follows:

"leadImage": {
  "type": "Reference",
  "settings": {
    "collection": "mediaStore"
  }
}

I think this is confusing, because mediaStore is actually a magic string that maps to an internal collection and therefore users don't need a schema for it. With the modularisation of field types introduced in 3.1, I think the above should be changed to:

"leadImage": {
  "type": "Image"
}

The settings block could describe the meta fields that are to be stored with the image.

Thoughts @jimlambie?

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented May 1, 2018

@eduardoboucas 😍

I agree - let's bring these features out into the open.

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented May 1, 2018

We could make it less breaking, by keeping both forms and deprecating the old one at some point,

@mingard

This comment has been minimized.

Copy link
Member

mingard commented May 2, 2018

Still keeping the settings block collection flag right?

@eduardoboucas

This comment has been minimized.

Copy link
Member Author

eduardoboucas commented May 2, 2018

We could keep it for a period of time like @jimlambie suggested, but the idea is to remove it at some point. The settings.collection field will still be used for normal Reference fields, of course, but in the case of media we're asking people to reference a collection they haven't created.

@mingard

This comment has been minimized.

Copy link
Member

mingard commented May 2, 2018

How does one choose which image collection the field is to use? Remember media supports multiple media collections, with a default. Although the default is often used, this shouldn't be forced.

@mingard

This comment has been minimized.

Copy link
Member

mingard commented May 2, 2018

Example:

"media": {
    "defaultBucket": "mediaStore",
    "buckets": [
      "mediaStore",
      "anotherMediaStore"
    ],
    "tokenSecret": "catboat-beatific-drizzle",
    "tokenExpiresIn": "1h",
    "storage": "local",
    "basePath": "content",
    "pathFormat": "date",
    "enabled": true
  }
@eduardoboucas

This comment has been minimized.

Copy link
Member Author

eduardoboucas commented May 2, 2018

You're absolutely right. That somehow slipped out of my mind!

The Image type could allow people to omit the settings block if they wanted to use the default media bucket, which like you said will often be the case. We could then allow them to change the media bucket by supplying an optional settings.mediaBucket property (supporting settings.collection for backward-compatibility).

I know these changes may seem irrelevant, but I really think that changing the semantics around media would help make it a first-class citizen in API.

@mingard

This comment has been minimized.

Copy link
Member

mingard commented May 2, 2018

SGTM

@danwdart

This comment has been minimized.

Copy link
Contributor

danwdart commented Aug 13, 2018

How much of this has been done?

@danwdart

This comment has been minimized.

Copy link
Contributor

danwdart commented Oct 9, 2018

This sounds like a really awesome suggestion - I'll change stuff to this when needed.

@eduardoboucas

This comment has been minimized.

Copy link
Member Author

eduardoboucas commented Nov 21, 2018

Closed in #504.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment