imgproxy
Version:
NodeJS client library to generate imgproxy urls
79 lines (77 loc) • 2.07 kB
text/typescript
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;
}
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;
}
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;
type ResizingType = 'fit' | 'fill' | 'fill-down' | 'force' | 'crop';
type HexColor = string;
interface RGBColor {
r: number;
g: number;
b: number;
}
interface FocusPoint {
x: number;
y: number;
}
interface OffsetGravity {
type: GravityType;
xOffset: number;
yOffset: number;
}
declare enum GravityType {
center = "ce",
north = "no",
south = "so",
east = "ea",
west = "we",
north_east = "noea",
north_west = "nowe",
south_east = "soea",
south_west = "sowe",
smart = "sm"
}
type Gravity = GravityType | FocusPoint | OffsetGravity;
declare enum WatermarkPosition {
center = "ce",
north = "no",
south = "so",
east = "ea",
west = "we",
north_east = "noea",
north_west = "nowe",
south_east = "soea",
south_west = "sowe",
replicate = "re"
}
interface WatermarkOffset {
x: number;
y: number;
}
export { type FocusPoint, type Gravity, GravityType, type HexColor, type ImgproxyConfig, type ImgproxySecureConfig, type OffsetGravity, type RGBColor, type ResizingType, type SignatureSize, type WatermarkOffset, WatermarkPosition };