JQuery Avatar cropping plug-in cropbox. js Usage Details, jquerycropbox. js
Almost every web page is required for Image Upload and image cropping. This function is implemented through the cropbox. js plug-in.
<script src="js/jquery-1.11.1.min.js"></script><script src="js/cropbox.js"></script><script type="text/javascript"> $(window).load(function() { var options = { thumbBox: '.thumbBox', spinner: '.spinner', imgSrc: 'images/avatar.png' } var cropper = $('.imageBox').cropbox(options); $('#file').on('change', function(){ var reader = new FileReader(); reader.onload = function(e) { options.imgSrc = e.target.result; cropper = $('.imageBox').cropbox(options); } reader.readAsDataURL(this.files[0]); this.files = []; }) $('#btnCrop').on('click', function(){ var img = cropper.getDataURL(); $('.cropped').append(''); }) $('#btnZoomIn').on('click', function(){ cropper.zoomIn(); }) $('#btnZoomOut').on('click', function(){ cropper.zoomOut(); }) });</script>
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.