mirror of
https://github.com/directus/directus.git
synced 2026-01-23 02:18: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
|
||||
|
||||
@@ -11391,7 +11391,7 @@
|
||||
},
|
||||
{
|
||||
"default_value": false,
|
||||
"field": "noupscale",
|
||||
"field": "withoutEnlargement",
|
||||
"interface": "toggle",
|
||||
"name": "No image upscale",
|
||||
"required": false,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -79,7 +79,7 @@ properties:
|
||||
height:
|
||||
description: Height of the thumbnail.
|
||||
type: integer
|
||||
noupscale:
|
||||
withoutEnlargement:
|
||||
description: No image upscale
|
||||
type: boolean
|
||||
quality:
|
||||
|
||||
@@ -33,7 +33,7 @@ get:
|
||||
schema:
|
||||
type: string
|
||||
enum: [crop, contain, inside, outside]
|
||||
- name: noupscale
|
||||
- name: withoutEnlargement
|
||||
in: query
|
||||
description: No image upscale.
|
||||
schema:
|
||||
|
||||
Reference in New Issue
Block a user