You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Croppr doesn't crop the image, it just provides you with the coordinates of the crop rectangle. It's up to you to do the cropping which could be done on the server side or the client side.
Here's an example of doing it on the client side with an HTML canvas.
constsourceImage=document.getElementById("sourceImage");constcroppr=newCroppr(sourceImage,{});// When finished croppingconstcropRect=croppr.getValue();constcanvas=document.createElement("canvas");constcontext=canvas.getContext("2d");canvas.width=cropRect.width;canvas.height=cropRect.height;context.drawImage(croppr.imageEl,cropRect.x,cropRect.y,cropRect.width,cropRect.height,0,0,canvas.width,canvas.height,);constdestinationImage=document.getElementById("destinationImage");destinationImage.src=canvas.toDataURL();
You can do whatever else you want with the data url, such as put it in a hidden field or send it to the server over an AJAX request.
How to export a cut picture?
The text was updated successfully, but these errors were encountered: