all-images-resizer-tool
v1.0.1
Published
Npm package that allows user to resize his img
Downloads
4
Readme
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
| Parameter | Type | Mandatory | Default | Options | |:--------------:|:--------:|:----------:|:------------:|:-------------------------------------------------------------------:| | width | int | ✅ | | Any integer | | height | int | ❌ | 0 | Any integer | | outputType | string | ❌ | png | png, jpeg | | encoderQuality | double | ❌ | 0.92 | 0.0 - 1.0 full quality - 1.0 medium quality - 0.5 low quality - 0.1 | | selectorClass | string | ❌ | empty string | Any 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