Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fire error event when cropper init failed #674

Open
7anshuai opened this issue Jun 3, 2020 · 5 comments
Open

Fire error event when cropper init failed #674

7anshuai opened this issue Jun 3, 2020 · 5 comments

Comments

@7anshuai
Copy link
Contributor

7anshuai commented Jun 3, 2020

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

@fengyuanchen
Copy link
Owner

I am not sure if this is really necessary now. I will think about this next.

@MTAugusto
Copy link

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.

@fengyuanchen
Copy link
Owner

@MTAugusto For your case, you can just check if the image URL is valid (loaded successfully) before init a cropper.

@thetbw
Copy link

thetbw commented Jan 11, 2022

@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

@RobbieTheWagner
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants