mirror of
https://github.com/directus/directus.git
synced 2026-01-28 04:38:21 -05:00
Allow custom transformations of assets (#6593)
* Allow custom transformations of assets This exposes one query parameter `transforms`, which is a JSON array of shard transformation operations. It also updates the asset presets. The UX for this still needs some work * Rename options to arguments for presets More explicit * options -> arguments in setting spec * Better errors for invalid JSON in asset presets * Add limit to transforms query parameter * Use flattened option for extra transforms * Fix placeholder color of code input * Allow "simple mode" aliases * Add documentation Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -85,5 +85,34 @@ properties:
|
||||
quality:
|
||||
description: Quality of the compression used.
|
||||
type: integer
|
||||
format:
|
||||
description: Reformat output image
|
||||
type: string
|
||||
enum:
|
||||
- ''
|
||||
- jpeg
|
||||
- png
|
||||
- webp
|
||||
- tiff
|
||||
transforms:
|
||||
description: Additional transformations to apply
|
||||
type: list
|
||||
nullable: true
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
method:
|
||||
description: The Sharp method name
|
||||
type: string
|
||||
arguments:
|
||||
description: A list of arguments to pass to the Sharp method
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
argument:
|
||||
description: A JSON representation of the argument value
|
||||
type: string
|
||||
example: null
|
||||
nullable: true
|
||||
|
||||
@@ -16,34 +16,11 @@ get:
|
||||
description: The key of the asset size configured in settings.
|
||||
schema:
|
||||
type: string
|
||||
- name: width
|
||||
- name: transforms
|
||||
in: query
|
||||
description: Width of the file in pixels.
|
||||
schema:
|
||||
type: integer
|
||||
- name: height
|
||||
in: query
|
||||
description: Height of the file in pixels.
|
||||
schema:
|
||||
type: integer
|
||||
- name: fit
|
||||
in: query
|
||||
description: Fit of the file
|
||||
description: A JSON array of image transformations
|
||||
schema:
|
||||
type: string
|
||||
enum: [crop, contain, inside, outside]
|
||||
- name: withoutEnlargement
|
||||
in: query
|
||||
description: No image upscale.
|
||||
schema:
|
||||
type: boolean
|
||||
- name: quality
|
||||
in: query
|
||||
description: Quality of compression.
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
- name: download
|
||||
in: query
|
||||
description: Download the asset to your computer
|
||||
|
||||
Reference in New Issue
Block a user