Use withoutEnlargement for more consistency

This commit is contained in:
e01
2020-10-19 20:56:14 +03:00
parent 8e4904f9c9
commit d776bb826d
9 changed files with 10 additions and 10 deletions

View File

@@ -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'];

View File

@@ -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');

View File

@@ -172,7 +172,7 @@ fields:
interface: numeric
required: true
width: half
- field: noupscale
- field: withoutEnlargement
type: boolean
schema:
default_value: false

View File

@@ -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;
}

View File

@@ -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