JSPM

image-proxy-yubi

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q20046F
  • License ISC

Image Proxy Yubi

Package Exports

  • image-proxy-yubi

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (image-proxy-yubi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

Installation

npm i -s @sholehmuhammad3/image-proxy-yubi
# or
yarn add @sholehmuhammad3/image-proxy-yubi

Usage

import ImgProxy from '@sholehmuhammad3/image-proxy-yubi';

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(0)
                        .extension('png')

console.log(myResizedImage.get()); // => "Image URL Result"


# Methods
`@sholehmuhammad3/image-proxy-yubi` 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