I've been searching the internet for a while now and cannot find anything that tells me how I turn the result from $('#image-cropper').cropit('export')
into an image that PHP can upload to the server. I'm using the Cropit plugin and all I need is an image that I can pass into my php upload script. My code is as follows:
HTML:
<div id="image-cropper">
<input type="file" class="cropit-image-input" />
<div class="cropit-image-preview"></div>
<input type="range" class="cropit-image-zoom-input" />
<button class="export">Export</button>
</div>
jQuery:
var username = "<?php echo $userData['username']; ?>";
$('#image-cropper').cropit({
imageState:{
src:'users/'+username+'/profile_picture.jpg'
},
});
$('#image-cropper').cropit('previewSize', {width:500, height:500});
$('.export').click(function() {
var imageData = $('#image-cropper').cropit('export');
//$("#code").val(imageData);
window.open(imageData);
});
The code here is working properly for the plugin but I'm unable to turn the result which looks something like data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD...
into an image that I can use in a php script. Any help would be great. Thanks!