image-square-resizer

js-utility for crop and resize image

Build It Yourself/Run the Demos

Build: npm install && npm run build

Demos: npm install && npm start

alt text

imager square resizer

Steps:

Init

import imageSqResizer from './image-square-resizer.js'

let resizer1 = new imageSqResizer(
    'image-input',
    300,
    null 
);

let resizer2 = new imageSqResizer(
    'image-input',
    50,
    (dataUrl) => 
        document.getElementById('image-output').src = dataUrl;
);

let resizer3 = new imageSqResizer(
    'image-input',
    50
);

Get blob

let formData = new FormData();
formData.append('files[0]', resizer1.blob);

Get dataUrl

document.getElementById('image-output').src = resizer2.dataUrl;

View Page

View Page