1.2.0 • Published 8 years ago

patchkit-image-uploader v1.2.0

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
8 years ago

Image Uploader

Open an image, scale and crop, and then upload.

screenshot.png

import ImageUploader from 'patchkit-image-uploader'
<ImageUploader ref="myImageInput" current="/img/pic1.jpg" onChange={onChange} />

When ready to read the image data (eg for uploading), use the canvasToPng function:

const canvas = this.refs.myImageInput.querySelector('canvas')
ImageInput.canvasToPng(canvas, function (err, buffer) {
  if (err) return cb(err)
  // buffer now contains png data
  // can do eg buffer.toString('base64')
})

Use the .less file:

@import "node_modules/patchkit-image-uploader/styles.less"