Skip to content

[feature] (provider/directus) Add Sharp transforms to modifiers, add support for keyed transforms #2194

@kheiner

Description

@kheiner

The current implementation of Directus Transforms is not typed appropriately, and not checked against any available functions. Directus uses Sharp on the backend, but not all functions work. There is also no implementation of the keyed transform option available in Directus.

The proposed enhancement should consider:

  • (feature): Support for Keyed Transforms using the key string, stripping all other transforms supported by Nuxt/Image
    • (test): Ensure that key if present is not paired with other modifiers.
    • (playground): Identify Directus instance that has pre-configured keys in the public space for better explanation to developers.
      • Option 1: https://sandbox.directus.io using key=800w or key=1200w. (customized transforms)
      • Option 2: using key=system-[small/medium/large]-[cover/contain]
  • (feature): Transforms should have typing for Image Operations, Color Manipulation, and Channel Manipulation as supported by Sharp.
  • (fix): The current transforms are typed as string[] which is not valid. Transforms should fallback to a tuple of type [string, ...any[]][] to prevent errors with using transforms not typed explicitly. (Future proofing for new transforms added to Sharp & supported by Directus.)
  • (docs): Update Docs ->
    • Provide a note that key requires setup in Directus. (Not actually true, see comment below)
    • Explicitly name Sharp Transforms that are supported (and link to details in Sharp Library)

I don't think this will break anything for existing users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions