1.0.1 • Published 4 years ago

all-images-resizer-tool v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Image resizer

  • Package that replace all images any img tag with the same image with specified width
  • If no height is specified, height is calculated based on width/height ratio of the original image
  • New image is placed in an a tag with reference (href) to original size image
  • If user doesn't want to convert all images, helper class (selectorClass) can be specified to narrow list of images that will be used

Installation

npm

Install

npm i all-images-resizer-tool --save

Usage

import { resizeImage } from 'all-images-resizer-tool';
resizeImage({
    width: 400
});

Parameteres

ParameterTypeMandatoryDefaultOptions
widthintAny integer
heightint0Any integer
outputTypestringpngpng, jpeg
encoderQualitydouble0.920.0 - 1.0 full quality - 1.0 medium quality - 0.5 low quality - 0.1
selectorClassstringempty stringAny class name

Usage

Links

To do

  • Find out a way to resize images before loading => save data transfer

Contributions

All suggections and ideas are welcome!

Licence

MIT