-
Notifications
You must be signed in to change notification settings - Fork 8
/
types.ts
93 lines (81 loc) · 2.29 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
export interface ImgproxyConfig {
/**
* The url where imgproxy runs.
*/
baseUrl: string;
/**
* If urls should be encoded with base64.
*/
encode?: boolean;
/**
* If insecure usage is supported by the service, true by default.
* When set to a string it will be used as the plain "signature".
*/
insecure?: boolean | string;
}
export interface ImgproxySecureConfig extends ImgproxyConfig {
/**
* The key to use for creating the signature.
*/
key: string;
/**
* The salt to use for creating the signature.
*/
salt: string;
/**
* Number of bytes to use for signature before encoding to Base64. Default: 32
*/
signatureSize?: SignatureSize;
insecure: false;
}
// prettier-ignore
export type SignatureSize =
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16
| 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24
| 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32;
export type ResizingType = 'fit' | 'fill' | 'fill-down' | 'force' | 'crop';
export type HexColor = string;
export interface RGBColor {
r: number;
g: number;
b: number;
}
export interface FocusPoint {
x: number;
y: number;
}
export interface OffsetGravity {
type: GravityType;
xOffset: number;
yOffset: number;
}
export enum GravityType {
center = 'ce', // default
north = 'no', // (top edge);
south = 'so', // (bottom edge);
east = 'ea', // (right edge);
west = 'we', // (left edge);
north_east = 'noea', // (top-right corner);
north_west = 'nowe', // (top-left corner);
south_east = 'soea', // (bottom-right corner);
south_west = 'sowe', // (bottom-left corner);
smart = 'sm', // libvips detects the most "interesting" section of the image and considers it as the center of the resulting image;
}
export type Gravity = GravityType | FocusPoint | OffsetGravity;
export enum WatermarkPosition {
center = 'ce', // default
north = 'no', // (top edge);
south = 'so', // (bottom edge);
east = 'ea', // (right edge);
west = 'we', // (left edge);
north_east = 'noea', // (top-right corner);
north_west = 'nowe', // (top-left corner);
south_east = 'soea', // (bottom-right corner);
south_west = 'sowe', // (bottom-left corner);
replicate = 're', // replicate watermark to fill the whole image;
}
export interface WatermarkOffset {
x: number;
y: number;
}