fengyuanchen / photo-editor

A simple photo editing application.
https://fengyuanchen.github.io/photo-editor
MIT License
936 stars 238 forks source link

get image blob without cropping #39

Closed mshqlaih closed 3 years ago

mshqlaih commented 3 years ago

hi know I can get image as blob after make any crop to the image , but I want to take image as blob without cropping it.

Thanks Maher

fengyuanchen commented 3 years ago

You don't need to make a crop, just call the getCroppedCanvas method directly:

cropper.clear().getCroppedCanvas().toBlob(function (blob) {
  console.log(blob);
});
mshqlaih commented 3 years ago

please more detail (or an exmple) , I put the photo-editor in iframe. how can I get the cropper as variable to do up answer? Thanks Maher

fengyuanchen commented 3 years ago

Just read the documentation of the Cropper.js: https://github.com/fengyuanchen/cropperjs

mshqlaih commented 3 years ago

hi after i upload my image the src of image is like this : blob:http://academicprogs.iugaza.edu/e6475d62-18dc-419d-adec-7719c10de1d3 then when i use your code above i faced this problem: Uncaught TypeError: Cannot read property 'toBlob' of null

any help please.