fengyuanchen / cropper

⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
MIT License
7.75k stars 1.74k forks source link

Download image using the cropper in modal example #1004

Closed Esteann closed 6 years ago

Esteann commented 6 years ago

I'm submitting a...


[- ] Feature request

Cropper version: v4.0.0
Browser:
- Chrome (desktop)

I am trying to download an image after cropping it in the modal : https://github.com/fengyuanchen/cropperjs/blob/master/examples/cropper-in-modal.html

Download button code:

$("#download_crop").click(function () {
var a = document.createElement('a');
a.href = cropBoxData.toDataURL().replace("image/png",
"image/octet-stream");
a.download = 'Capture.png'
a.click();
});
But I am getting an error :
Error : Uncaught TypeError: cropBoxData.toDataURL is not a function

fengyuanchen commented 6 years ago

What's the cropBoxData?