mirror of
https://github.com/directus/directus.git
synced 2026-02-01 06:35:00 -05:00
Use withoutEnlargement for more consistency
This commit is contained in:
@@ -36,4 +36,4 @@ export const SYSTEM_ASSET_ALLOW_LIST: Transformation[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const ASSET_TRANSFORM_QUERY_KEYS = ['key', 'width', 'height', 'fit', 'noupscale'];
|
||||
export const ASSET_TRANSFORM_QUERY_KEYS = ['key', 'width', 'height', 'fit', 'withoutEnlargement'];
|
||||
|
||||
@@ -117,7 +117,6 @@ router.get(
|
||||
|
||||
res.attachment(file.filename_download);
|
||||
res.setHeader('Content-Type', file.type);
|
||||
res.removeHeader('Content-Disposition');
|
||||
|
||||
if (req.query.hasOwnProperty('download') === false) {
|
||||
res.removeHeader('Content-Disposition');
|
||||
|
||||
@@ -172,7 +172,7 @@ fields:
|
||||
interface: numeric
|
||||
required: true
|
||||
width: half
|
||||
- field: noupscale
|
||||
- field: withoutEnlargement
|
||||
type: boolean
|
||||
schema:
|
||||
default_value: false
|
||||
|
||||
@@ -51,8 +51,8 @@ export class AssetsService {
|
||||
if (transformation.width) resizeOptions.width = Number(transformation.width);
|
||||
if (transformation.height) resizeOptions.height = Number(transformation.height);
|
||||
if (transformation.fit) resizeOptions.fit = transformation.fit;
|
||||
if (transformation.noupscale)
|
||||
resizeOptions.withoutEnlargement = Boolean(transformation.noupscale);
|
||||
if (transformation.withoutEnlargement)
|
||||
resizeOptions.withoutEnlargement = Boolean(transformation.withoutEnlargement);
|
||||
|
||||
return resizeOptions;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ export type Transformation = {
|
||||
width?: number; // width
|
||||
height?: number; // height
|
||||
fit?: 'cover' | 'contain' | 'inside' | 'outside'; // fit
|
||||
noupscale?: boolean; // Without Enlargement
|
||||
withoutEnlargement?: boolean; // Without Enlargement
|
||||
};
|
||||
|
||||
// @NOTE Keys used in Transformation should match ASSET_GENERATION_QUERY_KEYS in constants.ts
|
||||
|
||||
Reference in New Issue
Block a user