scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 307 forks source link

multiple instances #260

Open joethejones opened 6 years ago

joethejones commented 6 years ago

Hi, great tool, totally loving it!

I have an issue where after calling cropit, I'm only receiving an empty object;

var fData = new FormData(); var cpl = "", cps = "";

cpl += $('#cp-l-image-cropper').cropit(('export', {type: 'image/png'})); cps += $('#cp-s-image-cropper').cropit(('export', {type: 'image/png'}));

console.log(cpl); console.log(cps);

var lData = cpl.replace(/^data:image\/\w+;base64,/, ""); var sData = cps.replace(/^data:image\/\w+;base64,/, "");

fData.append("cp-l-logo", lData); fData.append("cp-s-logo", sData);

I'm firing the data off with an ajax call, but in the console, there's no data. I have three cropit instances on the page, but only trying to fire two during this one click.

The images are in completely separately named divs, which lines up with this issue.

This is part of my html;


Select image

Is there anything else I have to do to get hold of two loads of data?

Many, many thanks, Joe