@jsmonday/imgproxy

0.1.0 • Public • Published


JavaScript library for generating ImageProxy urls both on browser and server.

Installation

npm i -s @jsmonday/imgproxy
# or
yarn add @jsmonday/imgproxy

Usage

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()); // => "<imgproxy url>"

Methods

@jsmonday/imgproxy currently does not support all the imgproxy methods (it will do in the near future).

  • .image(<string>): The image to be resized
  • .width(<number>): Resize Width
  • .height(<number>): Resize height
  • .extension(<string>): The resized image extension
  • .gravity(<string>): The resize gravity
  • .enlarge(<number>: Enlarge image
  • .resizeType(<string): The resize type

License

MIT

Package Sidebar

Install

npm i @jsmonday/imgproxy

Weekly Downloads

134

Version

0.1.0

License

MIT

Unpacked Size

23.4 kB

Total Files

14

Last publish

Collaborators

  • micheleriva