ImgProxy Library for Node.js that works both on browser and server
npm install @jsmonday/imgproxyJavaScript library for generating ImageProxy urls both on browser and server.
``bash`
npm i -s @jsmonday/imgproxyor
yarn add @jsmonday/imgproxy
`js
import ImgProxy from "@jsmonday/imgproxy";
const proxy = new ImgProxy({
key: process.env.IMGPROXY_KEY,
salt: process.env.IMGPROXY_SALT,
url: process.env.IMGPROXY_URL
});
const myResizedImage = proxy
.image("https://example.com/img.jpg")
.width(500)
.height(500)
.extension("png")
console.log(myResizedImage.get()); // => "
`
currently does not support all the imgproxy methods (it will do in the near future).-
.image(: The image to be resized
- .width(: Resize Width
- .height(: Resize height
- .extension(: The resized image extension
- .gravity(: The resize gravity
- .enlarge(: Enlarge image
- .resizeType(