Open RehArk opened 1 week ago
I’m not entirely sure about the expected behavior you’re aiming for.
The current CropperJS implementation is designed to crop an existing image, and adapting it to work with non-uploaded images would require quite a few changes to its code. :/
// Method to update the image URL and reinitialize the cropper
updateImage(newImageUrl) {
this.img.src = newImageUrl; // Update the public URL value
this.initializeCropper(); // Reinitialize the cropper with the new image
}
This snippet wouldn’t work as expected because this.img
gets reset right after the line // Create image view
. I suppose you meant to reference this.publicUrl
instead?
If you need this kind of behavior, one possible solution could be to set the initial HTML inside a <template>
tag and dynamically create the <div>
whenever you have a new imageUrl.
Alternatively, maybe consider a custom controller? You could use the various events dispatched by the UX controller?
Hi everyone, I need to crop my image based on my file input, but the cropper is not allowing me to edit the image. I want to know if it is possible to do something like this to update the cropper: