I have sucessfully created a website that used the https://github.com/BossBele/cropzee library.
I have created a HTML form that takes inn a image from the user:
When the user has selected a image the Cropzee.js sucessfully loads and I can rotated/crop the image as expected:
Now I have the button Get Image (as blob / data-url) that gives me a alert box with a base64 image:
<button onclick="alert(cropzeeGetImage('cropzee-input'))">Get Image (as blob / data-url)</button>
I need to somehow send the base64 blob / data-url / image to my backend, I use PHP.
My HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cropzee jQuery PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0;"/>
<!-- jQuery + cropzee.js -->
<script type="text/javascript" src="javascripts/jquery/jquery.min.js"></script>
<script src="javascripts/cropzee/cropzee.js" defer></script>
<!-- //jQuery + cropzee.js -->
<!-- CSS -->
<style>
.image-previewer {
height: 300px;
width: 300px;
display: flex;
border-radius: 10px;
border: 1px solid lightgrey;
}
</style>
<!-- //CSS -->
</head>
<body>
<h1>Upload</h1>
<!-- cropzee upload form -->
<label for="cropzee-input" class="image-previewer" data-cropzee="cropzee-input"></label>
<input id="cropzee-input" type="file" name="cropzee-input" accept="image/*">
<button onclick="alert(cropzeeGetImage('cropzee-input'))">Get Image (as blob / data-url)</button>
<script>
$(document).ready(function(){
if (window.location.href.indexOf("#") > -1) {
window.location = window.location.href.replace('#', '');
}
$("#cropzee-input").cropzee({startSize: [85, 85, '%'],});
});
</script>
<!-- //cropzee upload form -->
</body>
</html>


