@uxf/resizer 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ You can use configuration file `.resizer-config.json` or environment variable `U
|
|
|
21
21
|
```json
|
|
22
22
|
[
|
|
23
23
|
{
|
|
24
|
-
"route": "/generated/:namespace/:p1/:p2/:filename([a-f0-9\\-]+)_:width(\\d+)_:height(\\d+)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d
|
|
24
|
+
"route": "/generated/:namespace/:p1/:p2/:filename([a-f0-9\\-]+)_:width(\\d+)_:height(\\d+)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d+|x)_:extension.:toFormat",
|
|
25
25
|
"source": "/var/www/UXF/projects/resizer/example-upload/:namespace/:p1/:p2/:filename.:extension"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -43,23 +43,23 @@ You can use configuration file `.resizer-config.json` or environment variable `U
|
|
|
43
43
|
"source": "https://uxf-base.uxf.dev/:filename+.:extension"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
"route": "/generated/:namespace/:p1/:p2/:filename([a-f0-9\\-]+)_:width(\\d+|x)_:height(\\d+|x)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d
|
|
46
|
+
"route": "/generated/:namespace/:p1/:p2/:filename([a-f0-9\\-]+)_:width(\\d+|x)_:height(\\d+|x)_:fit([a-z]+)_:position([a-z]+)_:background([a-z]+)_:trim([a-z]+)_:quality(\\d+|x)_:extension.:toFormat",
|
|
47
47
|
"source": "https://s3.uxf.dev/${APP_NAME}-${APP_ENV}/:namespace/:p1/:p2/:filename.:extension"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### Supported route parameters
|
|
53
|
-
| Parameter name | Type
|
|
54
|
-
|
|
55
|
-
| width | `number` or `x` (auto)
|
|
56
|
-
| height | `number` or `x` (auto)
|
|
57
|
-
| fit | `Fit`
|
|
58
|
-
| position | `Position`
|
|
59
|
-
| background | `FFFFFF` or `t` (transparent)
|
|
60
|
-
| toFormat | `webp`, `png`, `avif`, `jpg`
|
|
61
|
-
| trim | `number` or `nt` (not trim)
|
|
62
|
-
| quality | `number` (min: 1, max: 100)
|
|
53
|
+
| Parameter name | Type | Default sharp value |
|
|
54
|
+
|----------------|------------------------------------|----------------------------------------|
|
|
55
|
+
| width | `number` or `x` (auto) | `undefined` |
|
|
56
|
+
| height | `number` or `x` (auto) | `undefined` |
|
|
57
|
+
| fit | `Fit` | cover |
|
|
58
|
+
| position | `Position` | |
|
|
59
|
+
| background | `FFFFFF` or `t` (transparent) | |
|
|
60
|
+
| toFormat | `webp`, `png`, `avif`, `jpg` | `jpg` |
|
|
61
|
+
| trim | `number` or `nt` (not trim) | |
|
|
62
|
+
| quality | `number` (min: 1, max: 100) or `x` | default of sharp (avif: 50, other: 80) |
|
|
63
63
|
|
|
64
64
|
#### Fit
|
|
65
65
|
- `cv`: cover,
|
package/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var POSITION_OPTIONS = {
|
|
|
68
68
|
};
|
|
69
69
|
var getQuality = function (_a) {
|
|
70
70
|
var quality = _a.quality;
|
|
71
|
-
return (quality ? Number(quality) :
|
|
71
|
+
return (quality && quality !== "x" ? Number(quality) : undefined);
|
|
72
72
|
};
|
|
73
73
|
var getWidth = function (_a) {
|
|
74
74
|
var width = _a.width;
|