Skip to content

patchkit/patchkit-image-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Open an image, scale and crop, and then upload

Resources

Stars

Watchers

Forks

Packages

No packages published