javascriptphpcropper

How to get dataurl and display dataurl as image using cropper plugin


Been going through the cropper JavaScript plugin for cropping images for days. Can't figure it out. I'm a php person and JavaScript looks like Greek to me. Seems all the examples I've seen from google search assume the reader actually are familiar with JavaScript and I'm not. My challenge is which of the cropper methods actually stores the dataurl and how do I retrieve it to pass to a php script for processing into an image or to a JavaScript function to display on the same page as an image.


Solution

  • From the README.md on their github, it looks like you call this:

    var dataURL = $().cropper('getCroppedCanvas').toDataURL('image/jpeg');
    

    https://github.com/fengyuanchen/cropper/blob/master/README.md