jamesssooi / Croppr.js

A vanilla JavaScript image cropper that's lightweight, awesome, and has absolutely zero dependencies.
https://jamesooi.design/Croppr.js
MIT License
396 stars 91 forks source link

How to crop the image and get the dataUrl? #3

Closed sahandnayebaziz closed 7 years ago

sahandnayebaziz commented 7 years ago

I understand how to set Croppr up, but how do I actually get the cropped image after the user is done cropping the image?

jamesssooi commented 7 years ago

Croppr does not actually crop the image for you. It's function is to simply retrieve the cropping coordinates so that other services (such as your backend) can do the actual cropping. It was made on the understanding that it's safer to perform server-side image manipulation rather than trusting the user's input entirely.

However, if you do insist on performing client-side cropping (or a mix of both), you are free to use your own implementation for the actual image cropping part. You can refer to this link for further information:

sahandnayebaziz commented 7 years ago

Ah, I see. Wonderful. Thank you @jamesssooi :)