JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgit.com/Foliotek/Croppie/master/croppie.js"></script>
<link rel="stylesheet" href="https://rawgit.com/Foliotek/Croppie/master/croppie.css">
<div class="area">
<button id="button">ShowResult()</button>
<br/>
<img id="result"/>
</div>
<img id="demo"/>
CSS
.area {
min-height: 200px;
}
#result {
border: 1px solid black;
}
JavaScript
var element = document.getElementById('demo')
var croppie = new Croppie(element, {
enforceBoundary: false,
viewport: {
width: 200,
height: 200,
type: 'circle'
},
boundary: {
width: 300,
height: 300
}
});
croppie.bind({url: "https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png"});
var button = document.getElementById('button')
button.addEventListener("click", showResult);
var elementResult = document.getElementById('result')
function showResult() {
croppie.result({type: 'canvas'}).then(function(base64) {
elementResult.src = base64;
});
}