mirror of
https://github.com/directus/directus.git
synced 2026-01-29 12:58:00 -05:00
* 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>
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import { TransformationParams } from './types';
|
|
|
|
export const SYSTEM_ASSET_ALLOW_LIST: TransformationParams[] = [
|
|
{
|
|
key: 'system-small-cover',
|
|
transforms: [['resize', { width: 64, height: 64, fit: 'cover' }]],
|
|
},
|
|
{
|
|
key: 'system-small-contain',
|
|
transforms: [['resize', { width: 64, fit: 'contain' }]],
|
|
},
|
|
{
|
|
key: 'system-medium-cover',
|
|
transforms: [['resize', { width: 300, height: 300, fit: 'cover' }]],
|
|
},
|
|
{
|
|
key: 'system-medium-contain',
|
|
transforms: [['resize', { width: 300, fit: 'contain' }]],
|
|
},
|
|
{
|
|
key: 'system-large-cover',
|
|
transforms: [['resize', { width: 800, height: 800, fit: 'cover' }]],
|
|
},
|
|
{
|
|
key: 'system-large-contain',
|
|
transforms: [['resize', { width: 800, fit: 'contain' }]],
|
|
},
|
|
];
|
|
|
|
export const ASSET_TRANSFORM_QUERY_KEYS = [
|
|
'key',
|
|
'transforms',
|
|
'width',
|
|
'height',
|
|
'format',
|
|
'fit',
|
|
'quality',
|
|
'withoutEnlargement',
|
|
];
|
|
|
|
export const FILTER_VARIABLES = ['$NOW', '$CURRENT_USER', '$CURRENT_ROLE'];
|
|
|
|
export const ALIAS_TYPES = ['alias', 'o2m', 'm2m', 'm2a', 'files', 'files', 'translations'];
|