2.0.4 • Published 6 years ago

react-image-file-cropper v2.0.4

Weekly downloads
98
License
MIT
Repository
github
Last release
6 years ago

react-image-file-cropper

It provides you a button to upload the file with image preview and cropper according to the need

Cropperjs as React components

NPM

Demo

Docs

Installation

Install via npm

npm install --save react-image-file-cropper

You need cropper.css in your project or you can use directly styles from this file .

Changelog

Todo

  • Unit test

Quick Example

import React, {Component} from 'react';
import ImageCropper from 'react-image-file-cropper';
import 'react-image-file-cropper/cropper.css'; 

class Demo extends Component {
  onCrop(blob) {
    console.log("onCrop ", blob);
  }

  onChange(file) {
    console.log("onChange ", file);
  }

  render() {
    return (
        <ImageCropper 
            cropper={true} 
            preview={true} 
            onCrop={this.onCrop} 
            onChange={this.onChange}
            aspectRatio={1/ 1}
        />
    );
  }
}

Options

aspectRatio

https://github.com/fengyuanchen/cropperjs#aspectratio

cropper

If you provide the value true, cropper will appear, if you dont want a cropper, and only preview is needed you can use the preview option only.

preview

If you only want to preview the file uploaded you can user this option.

If you dont use a preview or cropper option a button will apper which will give you the selected file .

Methods

onCrop

It will provide the blob after cropping

onChange

It will provide the file after selecting

Build

npm run build
npm run build-example

Author

Adarsh ks(adarshs.adarshs@gmail.com)

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

8.0.0

6 years ago

7.0.0

6 years ago

6.0.0

6 years ago

5.0.0

6 years ago

4.0.0

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago