cropperjs
cropperjs copied to clipboard
Fire error event when cropper init failed
Is your feature request related to a problem? Please describe. When init cropper failed, fire an error event. Ex. init cropper with a cross-origin URL and load the target image failed.
Describe the solution you'd like
Add error
event support. Like the ready
event, but fires when the target image load failed and the cropper instance is not ready for operating.
Describe alternatives you've considered Before init cropper with an image URL, the user should check the image URL worked as expect manually.
Additional context Commits about error event
I am not sure if this is really necessary now. I will think about this next.
Any possibility of launching this feature? I would like the same solution, because when the url passed in the image is broken or does not exist, I would like to shoot something for the user.
@MTAugusto For your case, you can just check if the image URL is valid (loaded successfully) before init a cropper.
@MTAugusto For your case, you can just check if the image URL is valid (loaded successfully) before init a cropper.
He will consume extra traffic if the picture is bigger
You can use onerror
on your img element to handle this https://medium.com/@vipinc.007/html-do-you-know-img-tag-has-an-onerror-event-62011d45959