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

Image cropper fallback image #5936

Closed
njannink opened this issue Jan 17, 2025 · 6 comments · May be fixed by #5937
Closed

Image cropper fallback image #5936

njannink opened this issue Jan 17, 2025 · 6 comments · May be fixed by #5937
Assignees
Labels
Type: Feature ⚙ Request or idea for a new feature.

Comments

@njannink
Copy link
Contributor

I would like a way to set a fallback image for when loading of the image fails or no source has been set yet so you won't see the empty gray canvas, but you can show a placeholder image.

There is an ImageReady event, but it doesn't indicate if loading actually succeeded. Maybe this event can return a bool value?

@njannink njannink added the Type: Feature ⚙ Request or idea for a new feature. label Jan 17, 2025
@njannink
Copy link
Contributor Author

Maybe an additional event (ImageFailed) can be put if you don't want to change the current api

@tesar-tech
Copy link
Collaborator

Thanks for mentioning this.

It was actually implemented #5916 (comment)

I will finish it for the next release.

@njannink
Copy link
Contributor Author

only thing missing is then the fallback/unset source image

@tesar-tech
Copy link
Collaborator

I don't think placing fallback images should be something that Blazorise is responsible for. Such an image is highly opinionated: dark theme or light? With text or without? What about the language? Additionally, it would add resources to the library, which would increase its size—not by much, but for such a low-use case, I don't think it's worth it.

The cropper is designed to be used with a valid source. If the source isn't valid, the component won't throw an error but will gracefully notify the developer. The issue of an invalid source doesn't originate from the cropper component itself, which is why I think the cropper shouldn't be responsible for handling user interactions in this state. There are plenty of ways to handle such scenarios—hiding the cropper, placing a fallback image, or showing an error message to the user. Developer should decide and implement the proper "flow"...

wdyt, @stsrki?

@stsrki
Copy link
Collaborator

stsrki commented Jan 20, 2025

I agree with @tesar-tech, it's better to leave the fallback image to the developer. We will just provide an API that is used to determine the error.

@njannink
Copy link
Contributor Author

one of this issues with this is that the cropper component is very javascript heavy so you see if flicker, because of the round-trip between js and blazor. But I understand that you like to keep it this way. I will put an enhancement request in the cropper.js library to see if there is a way to replace the gray background with some other image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature ⚙ Request or idea for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants