0.0.1 • Published 5 years ago

react-form-upload-image-resize v0.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

ImageUploadResizer

This is react component for form input type file. Component goal is to resize uploaded image and convert it to jpeg format encoded as base64 for later uses.

Installation

This can also be installed with npm.

Pending

Git clone

$ git clone git@bitbucket.org:dainiusgliebus/react-form-upload-image-resize.git
$ cd react-form-upload-image-resize
$ npm install
$ npm link

# in your project folder
$ npm link react-form-upload-image-resize

Usage

Use URLSearchParams directly. You can instantiate a new instance of URLSearchParams from a string or an object.

// import component into your react component
import ImageUploadResizer from 'react-form-upload-image-resize';

// put code where you want to have upload image input
<ImageUploadResizer change={callback} width={200} height={200} />

Props

PropRequiredValueDescription
heighttrueintResized image max height (default 200px)
widthtrueintResized image max width (default 200px)
changetruecallbackCallback function to get processed uploaded image
idfalsestringInput element id
namefalsestringInput element name
stylefalseobjStyle object
classesfalsestringCSS classes

LICENSE

MIT license