-
Notifications
You must be signed in to change notification settings - Fork 14
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
Dynamically Change Image in Cropper Element #150
Comments
You can see that functionality in demo site: https://cropperblazor.github.io/demo |
it's changing through Browse but i have url's of image that appears conditionally how to change image through URL not browsing |
You can use replace function, for instance: |
There is nothing Function like ReplaceAsync have you added it now? |
It was already in the cropper js service, but it was not added to the cropper component |
You can use the new version of the package right now! |
I'm sorry, but unfortunately, after replacing the image, the functions become dead for some reason, me need to find out what's going wrong |
Hi @HasanAnsar . Now, in package version 1.2.2 it should work. Example:
In addition, if you use error handling code should likewise that:
Don't forget to setup OnErrorLoadImageEvent event if you use that approach (You can see a sample in the cropper demo resources) |
I'm currently using version 1.2.4 and I still have the same problem. unlike your example, I receive the image url via an event and I'd like to replace it in the component. I've made the adjustments described above but the image is just replaced by the cropper box size. when I relaunch the component I get the real size of the image outside the component so it's impossible to work. Could you help me? |
Hi @Vian237. Sorry, I'm fuzzy underhand your expectations. Could you provide more details about result of work? Maybe you want to see a complete reload of the component with the image replaced and centered according to the image dimensions, right? |
Hi @MaxymGorn the image is replaced but at the size of the cropper box previously used but when I reload the component the image seems not to be correctly replaced and not centered in the component. Yes, I think a complete reload of the component with the new image (dimensions and center) should help solve my problem. Because the idea is to be able to edit the image with the component. |
@Vian237 just try to use this functionality: Code:
|
@Vian237 let me know if it work properly with this case! |
Hi @MaxymGorn I tried it before I came across this thread. In my context I receive the image directly as a string and so I can't use the "GetImageUsingStreamingAsync" method because I don't have an HTLM tag. The problem I had with this code was that when the first image is received, the component behaves well, then when the 2nd is received, it displays all the images in a row. That's why I wanted to use the "Replace" method. I think the "Destroy()" method doesn't work because maybe the image isn't updated in the component because I'm changing the source directly to the new image. |
@Vian237 Sure, the original src don't updated in case when you gathering replace image |
Replace method shouldn't call Destroy method Blazor cropper component |
I would investigate this point, how to center the image after replacing... |
Hi @Vian237. |
How I can dynamically change image in cropper element through components parameter?
The text was updated successfully, but these errors were encountered: