@imgproxy/imgproxy-node
Version:
Official node url-builder lib for imgproxy - fast and secure standalone server for resizing and converting remote images
92 lines (88 loc) • 4.62 kB
TypeScript
// Generated by dts-bundle-generator v8.0.1
import { Options, OptionsImageInfo, URLImageInfo } from '@imgproxy/imgproxy-js-core';
export interface IRawUrl {
value: string;
displayAs?: URLImageInfo["type"];
}
export interface BaseGenerateImageUrl {
endpoint: string;
url: string | IRawUrl;
salt?: string;
key?: string;
encryptKey?: string;
encryptIV?: string;
}
export interface IGenerateImageInfoUrl extends BaseGenerateImageUrl {
options?: OptionsImageInfo;
}
export interface IGenerateImageUrl extends BaseGenerateImageUrl {
options?: Options;
}
/**
* Generate image url
* @param {string} endpoint - Base url
* @param {Object | string} url - you can specify only url if you agree with default url.displayAs = "base64" or you have to specify url.value and url.displayAs
* @param {string} url.value - url value
* @param {string} url.displayAs - (optional) how the image URL should be presented in the resulting imgproxy request URL.
* Imgproxy request URL: "plain", "base64" or "encrypted" (encrypted is PRO feature). We strongly recommend to use "base64" or "encrypted" kind of url. default: `"base64"`
* @param {Object} [options] - (optional) options. You can see all options in [imgproxy docs](https://docs.imgproxy.net/generating_the_url?id=processing-options)
* or in Options types in imgproxy-js-core.d.ts
* @param {string} [salt] - (optional) hex-encoded salt. This option overrides IMGPROXY_SALT from process.env for this request
* @param {string} [key] - (optional) hex-encoded key. This option overrides IMGPROXY_KEY from process.env for this request
* @param {string} [encryptKey] - (optional, PRO feature) hex-encoded key for encrypting url.
* This option overrides IMGPROXY_SOURCE_URL_ENCRYPTION_KEY from process.env for this request
* @param {string} [encryptIV] - (optional, PRO feature) hex-encoded 16-bytes length IV for encrypting url.
* More details about IV you can read in [imgproxy docs](https://docs.imgproxy.net/usage/encrypting_source_url#iv-generation)
*
* @returns {string}
*
* @example
* const url = generateImageUrl({
* endpoint: "https://imgproxy.example",
* url: "https://example.com/image.jpg",
* options: {
* resize: { width: 100, height: 100, type: "fill", enlarge: 1, extend: { extend: 1 } },
* rotate: 90,
* quality: 80,
* format: "webp",
* },
* salt: "salt",
* key: "key",
* });
*/
export declare const generateImageUrl: ({ endpoint: paramsEndpoint, url, options, salt, key, encryptKey, encryptIV, }: IGenerateImageUrl) => string;
/**
* Generate image info url. **PRO feature**
* @param {string} endpoint - Base url
* @param {Object | string} url - you can specify only url if you agree with default url.displayAs = "base64" or you have to specify url.value and url.displayAs
* @param {string} url.value - url value
* @param {string} url.displayAs - (optional) here you specify in what type of image URL is required in the generated.
* Imgproxy request URL: "plain", "base64" or "encrypted" (encrypted is PRO feature). We strongly recommend to use "base64" or "encrypted" kind of url. default: `"base64"`.
* @param {Object} [options] - (optional) options. You can see all options in [imgproxy docs](https://docs.imgproxy.net/getting_the_image_info?id=info-options)
* or in OptionsImageInfo types in imgproxy-js-core.d.ts
* @param {string} [salt] - (optional) hex-encoded salt. This option overrides IMGPROXY_SALT from process.env for this request
* @param {string} [key] - (optional) hex-encoded key. This option overrides IMGPROXY_KEY from process.env for this request
* @param {string} [encryptKey] - (optional, PRO feature) hex-encoded key for encrypting url. Actual only for plain url type.
* This option overrides IMGPROXY_SOURCE_URL_ENCRYPTION_KEY from process.env for this request
** @param {string} [encryptIV] - (optional, PRO feature) hex-encoded 16-bytes length IV for encrypting url.
* More details about IV you can read in [imgproxy docs](https://docs.imgproxy.net/usage/encrypting_source_url#iv-generation)
*
* @returns {string}
*
* @example
* const url = generateImageInfoUrl({
* endpoint: "https://imgproxy.example",
* url: "https://example.com/image.jpg",
* options: {
* average: { average: 1, ignore_transparent: "f" },
* detect_objects: true,
* dominant_colors: { dominant_colors: 1, build_missed: 1 },
* iptc: 1,
* palette: 6,
* },
* salt: "salt",
* key: "key",
* });
*/
export declare const generateImageInfoUrl: ({ endpoint: paramsEndpoint, url, options, salt, key, encryptKey, encryptIV, }: IGenerateImageInfoUrl) => string;
export {};