|
| 1 | +/** |
| 2 | + * Boolean-like values for EXIF option fields. |
| 3 | + * |
| 4 | + * @note Only `1`, `"t"`, or `true` are recognized as truthy values. |
| 5 | + * Any other value (including `"true"` or `"1"` as strings) will be treated as false. |
| 6 | + */ |
| 7 | +type ExifBooleanValue = 1 | 0 | "t" | "f" | boolean | string; |
| 8 | + |
| 9 | +/** |
| 10 | + * *EXIF option (object form)* |
| 11 | + * |
| 12 | + * @param {ExifBooleanValue} enabled - When set to `1`, `"t"` or `true`, |
| 13 | + * imgproxy will return the image’s EXIF metadata. Default: `true`. |
| 14 | + * @param {ExifBooleanValue} canonical_names - When set to `1`, `"t"` or `true`, |
| 15 | + * imgproxy will return the EXIF metadata field names in a canonical form |
| 16 | + * (e.g. `DateTimeOriginal`) instead of a human-readable form |
| 17 | + * (e.g. `Date and Time (Original)`). Default: `false`. |
| 18 | + */ |
| 19 | +interface ExifObject { |
| 20 | + enabled?: ExifBooleanValue; |
| 21 | + canonical_names?: ExifBooleanValue; |
| 22 | +} |
| 23 | + |
1 | 24 | /** |
2 | 25 | * *EXIF option* |
3 | 26 | * |
4 | | - * When set to `1`, `"t"` or `true`, imgproxy will return the image’s EXIF metadata. |
| 27 | + * When `enabled` is set to `1`, `"t"` or `true`, imgproxy will return the image’s EXIF metadata. |
| 28 | + * When `canonical_names` is set to `1`, `"t"` or `true`, imgproxy will return the EXIF |
| 29 | + * metadata field names in a canonical form (e.g. `DateTimeOriginal`) instead of a |
| 30 | + * human-readable form (e.g. `Date and Time (Original)`). |
| 31 | + * |
| 32 | + * Accepts a plain boolean-like value (controls `enabled` only) or an object |
| 33 | + * `{ enabled, canonical_names }`. |
5 | 34 | * |
6 | 35 | * @note If any value other than `1`, `"t"`, or `true` is passed, it will be recognized as `false`. |
7 | 36 | * |
|
16 | 45 | * } |
17 | 46 | * } |
18 | 47 | * |
19 | | - * @default true |
| 48 | + * @default true:false |
20 | 49 | * |
21 | 50 | * |
22 | | - * @see {@link https://docs.imgproxy.net/getting_the_image_info?id=exif | EXIF imgproxy docs} |
| 51 | + * @see {@link https://docs.imgproxy.net/usage/getting_info#exif | EXIF imgproxy docs} |
23 | 52 | */ |
24 | | -type Exif = 1 | "t" | true | false | string; |
| 53 | +type Exif = ExifBooleanValue | ExifObject; |
25 | 54 |
|
26 | 55 | /** |
27 | 56 | * *EXIF option* |
28 | 57 | * |
29 | 58 | * To describe the EXIF option, you can use the keyword `exif`. |
30 | 59 | * |
31 | | - * @see https://docs.imgproxy.net/getting_the_image_info?id=exif |
| 60 | + * @see https://docs.imgproxy.net/usage/getting_info#exif |
32 | 61 | */ |
33 | 62 | interface ExifImageInfoOptionsPartial { |
34 | 63 | exif?: Exif; |
35 | 64 | } |
36 | 65 |
|
37 | | -export { Exif, ExifImageInfoOptionsPartial }; |
| 66 | +export { Exif, ExifObject, ExifBooleanValue, ExifImageInfoOptionsPartial }; |
0 commit comments