0.1.1 • Published 6 years ago

img-cropped v0.1.1

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

Image cropped

A simple and practical image cropping plugin.

Usage

Here's a demo about react:

import React from 'react';
import imgCropped from 'img-cropped';

export default ImageCropped class extends React.Component {
  render() {
    return <button onClick={imgCropped}>upload</button>
  }
}

Is that simple! if you want to customize some parameters, the following parameters can help you.

Options

imgCropped(options) inside the parameters as follows:

  • canvasWidth: Canvas width, the default value is 500px.
  • canvasHeight: Canvas height, the default value is 350px.
  • cutWidth: Cut box width, the default value is 200px.
  • cutHeight: Cut box height, the default value is 200px.
  • fillCutStyle: Cut box default fill color, the default value is rgba(255, 255, 255, .5).
  • cutCallbackOk: Determine the clip after the callback, the default value is null. The returned value is the base64 encoded data of the cropped area.

License

The image cropped is released under the MIT license.