1.0.6 • Published 4 years ago

imtae-resizer v1.0.6

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

imtae-resizer

Resize image volume before sending to server.

Installation

npm install imtae-resizer --save

or

yarn add imtae-resizer

Usage

Params
(Essential) filesFiles uploaded by the user. ex) evt.target.files of the input tag change event.
(Optional) maxWidthBased on this value, the image size is modified to fit the ratio. The default value for maxWidth is 600.
import imtaeResizer from 'imtae-resizer';

imtaeResizer(files, maxWidth).then(result => {
  // Before
  console.log(files);
  // After
  console.log(result);
});

Example

create-react-app

import React from 'react';
import imtaeResizer from 'imtae-resizer';

function App() {
  const resizeImg = files => {
    imtaeResizer(files, 800).then(result => {
      // ...
    });
  }

  return (
    <div className="App">
      <input 
        type="file" 
        multiple 
        onChange={evt => resizeImg(evt.target.files)} 
      />
    </div>
  );
}

export default App;
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago