imgproxy-url-builder 0.4.0
Install from the command line:
Learn more about npm packages
$ npm install @BitPatty/imgproxy-url-builder@0.4.0
Install via package.json:
"@BitPatty/imgproxy-url-builder": "0.4.0"
About this version
A helper library for building Imgproxy URLs.
npm i --save @bitpatty/imgproxy-url-builderYou can simply import the param builder and chain your transformations.
For a list of available transformations visit the API documentation page.
import pb from '@bitpatty/imgproxy-url-builder';
// Just the transformer params
// Returns rot:90/bl:10
pb().rotate(90).blur(10).build();
// The transformer params with the target image
// Returns /-/rot:90/bl:10/czM6Ly9teWJ1Y2tldC9teWltYWdlLnBuZw
pb().rotate(90).blur(10).build({
path: 's3://mybucket/myimage.png',
});
// You can disable path encoding by setting 'plain' to true
// Returns /-/rot:90/bl:10/plain/s3://mybucket/myimage.png
pb().rotate(90).blur(10).build({
plain: true,
path: 's3://mybucket/myimage.png',
});
// To sign your URL provide the key and salt
// The path is required to sign your URL!
// Returns /TXf2QXtZkU-ULvrg0pLDqJlWUb7XdHkXD0h6NFWD-mo/rot:90/bl:10/czM6Ly9teWJ1Y2tldC9teWltYWdlLnBuZw
pb()
.rotate(90)
.blur(10)
.build({
path: 's3://mybucket/myimage.png',
signature: {
key: 'a91bdcda48ce22cd7d8d3a0eda93',
salt: 'a91bdcda48ce22cd7d8d3a0eda93',
},
});
// To automatically prepend the imgproxy URL
// provide it as the 'baseUrl' setting
// Returns https://my-imgproxy-instance.example.com/-/rot:90/bl:10/czM6Ly9teWJ1Y2tldC9teWltYWdlLnBuZw
pb().rotate(90).blur(10).build({
path: 's3://mybucket/myimage.png',
baseUrl: 'https://my-imgproxy-instance.example.com',
});| Transformation | Supported |
|---|---|
Adjust |
〰 (via brightness / contrast / saturation) |
Auto Rotate |
☑ |
Background Alpha |
☑ |
Background |
☑ |
Blur |
☑ |
Brightness |
☑ |
Cache Buster |
☑ |
Contrast |
☑ |
Crop |
☑ |
Dpr |
☑ |
Enlarge |
☑ |
Expires |
☑ |
Extend |
☑ |
Fallback Image URL |
☑ |
Filename |
☑ |
Format |
☑ |
Format Quality Options |
☑ |
GIF options |
☑ |
Gravity |
☑ |
Height |
〰 (via Resize) |
JPEG options |
☑ |
Max Bytes |
☑ |
Min Height |
☑ |
Min Width |
☑ |
Padding |
☑ |
Page |
☑ |
Pixelate |
☑ |
PNG options |
☑ |
Preset |
☑ |
Quality |
☑ |
Resize |
☑ |
Resizing Algorithm |
☑ |
Rotate |
☑ |
Saturation |
☑ |
Sharpen |
☑ |
Signature |
☑ |
Size |
〰 (via Resize) |
Skip Processing |
☑ |
Strip Color Profile |
☑ |
Strip Metadata |
☑ |
Style |
☑ |
Trim |
☑ |
Unsharpening |
☑ |
Video Thumbnail Second |
☑ |
Watermark URL |
☑ |
Watermark Size |
☑ |
Watermark Text |
☑ |
Watermark |
☑ |
Width |
〰 (via Resize) |
Zoom |
☑ |