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

View File

@@ -11391,7 +11391,7 @@
},
{
"default_value": false,
"field": "noupscale",
"field": "withoutEnlargement",
"interface": "toggle",
"name": "No image upscale",
"required": false,

View File

@@ -44,7 +44,8 @@ Fetching thumbnails is as easy as adding query parameters to the original file's
* **`width`** — The **width** of the thumbnail in pixels
* **`height`** — The **height** of the thumbnail in pixels
* **`quality`** — The **quality** of the thumbnail (`0` to `100`)
* **`noupscale`** — Disable image up-scaling
* **`withoutEnlargement`** — Disable image up-scaling
* **`download`** — Add `Content-Disposition` header and force browser to download file
```
example.com/assets/<file-id>?fit=<fit>&width=<width>&height=<height>&quality=<quality>

View File

@@ -79,7 +79,7 @@ properties:
height:
description: Height of the thumbnail.
type: integer
noupscale:
withoutEnlargement:
description: No image upscale
type: boolean
quality:

View File

@@ -33,7 +33,7 @@ get:
schema:
type: string
enum: [crop, contain, inside, outside]
- name: noupscale
- name: withoutEnlargement
in: query
description: No image upscale.
schema: