mirror of
https://github.com/directus/directus.git
synced 2026-01-31 09:18:22 -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:
@@ -1,42 +1,42 @@
|
||||
import { Transformation } from './types';
|
||||
import { TransformationParams } from './types';
|
||||
|
||||
export const SYSTEM_ASSET_ALLOW_LIST: Transformation[] = [
|
||||
export const SYSTEM_ASSET_ALLOW_LIST: TransformationParams[] = [
|
||||
{
|
||||
key: 'system-small-cover',
|
||||
width: 64,
|
||||
height: 64,
|
||||
fit: 'cover',
|
||||
transforms: [['resize', { width: 64, height: 64, fit: 'cover' }]],
|
||||
},
|
||||
{
|
||||
key: 'system-small-contain',
|
||||
width: 64,
|
||||
fit: 'contain',
|
||||
transforms: [['resize', { width: 64, fit: 'contain' }]],
|
||||
},
|
||||
{
|
||||
key: 'system-medium-cover',
|
||||
width: 300,
|
||||
height: 300,
|
||||
fit: 'cover',
|
||||
transforms: [['resize', { width: 300, height: 300, fit: 'cover' }]],
|
||||
},
|
||||
{
|
||||
key: 'system-medium-contain',
|
||||
width: 300,
|
||||
fit: 'contain',
|
||||
transforms: [['resize', { width: 300, fit: 'contain' }]],
|
||||
},
|
||||
{
|
||||
key: 'system-large-cover',
|
||||
width: 800,
|
||||
height: 600,
|
||||
fit: 'cover',
|
||||
transforms: [['resize', { width: 800, height: 800, fit: 'cover' }]],
|
||||
},
|
||||
{
|
||||
key: 'system-large-contain',
|
||||
width: 800,
|
||||
fit: 'contain',
|
||||
transforms: [['resize', { width: 800, fit: 'contain' }]],
|
||||
},
|
||||
];
|
||||
|
||||
export const ASSET_TRANSFORM_QUERY_KEYS = ['key', 'width', 'height', 'fit', 'withoutEnlargement', 'quality'];
|
||||
export const ASSET_TRANSFORM_QUERY_KEYS = [
|
||||
'key',
|
||||
'transforms',
|
||||
'width',
|
||||
'height',
|
||||
'format',
|
||||
'fit',
|
||||
'quality',
|
||||
'withoutEnlargement',
|
||||
];
|
||||
|
||||
export const FILTER_VARIABLES = ['$NOW', '$CURRENT_USER', '$CURRENT_ROLE'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user