-
Notifications
You must be signed in to change notification settings - Fork 126
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
Vue.js vue-advanced-cropper error #34
Comments
Hello, @igogoson! I suppose, that you use the same variable for |
Just had the same issue. What I have:
The problem is within Converter code. I upload an 2.5MB image. The image has not uploaded, but modal with cropper already opened (i.e. opened without image). So, I needed to move modal opening inside
This fixed the issue. |
@TitanFighter, are you saying, that you has the following error?
Have you encountered the recursive cropping? |
Yes
No. Maybe because I save cropped image to |
It makes your issue different than issue of @igogoson, and I still should investigate it carefully. I would be grateful for codesandbox that reproduces your problem. |
My problem comes when I do at @change="onChange". I can not read the canvas and yet I am using the exact code on your documentation. The image crops infinitely and I get the following error [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'toDataURL' of undefined" my onChange function is onChange({coordinates, canvas}) { and cropper looks like this <Cropper |
Here is the link to the code. when I add @change method this happens |
@Norserium this is the demo you requested. In codesandbox it works. I even tried to upload 10 mb photo + additionally tried to simulate a delay using setTimeout - still works :) Probably I will be able to play a bit more locally with my project during the upcoming weekend in order to double-check the problem and inform you about the result. |
@igogoson, there is an error in your codesandbox. Pay attention, you use the <Cropper class="upload-example-cropper" :src="image" @change="onChange"/> But you put the result in the same variable: onChange({coordinates, canvas}) {
this.coordinates = coordinates
// You able to do different manipulations at a canvas
// but there we just get a cropped image
this.image = canvas.toDataURL()
}, So, it lead to infinite recursion. You update the source image on change, then the cropper gets the updated image and crop it again, and etc. You shouldn't use the same variable for result image and source. Compare your sandbox with this sandbox. |
@TitanFighter, thank you! If you succeed and catch the reason of this bug, please inform me. |
@Norserium I created a local freshly new project with the code from my linked demo - everything is ok. Probably my current project related issue, so in case if I catch this problem again - I will be back with more details. |
@TitanFighter, thank you! Keep me informed. |
@TitanFighter, @igogoson I close this issue, but if you encounter this problem in the future, feel free to write here. |
When I select an image it is continuously cropping the image in a loop until it can't crop anymore. I am getting this error in my logs
app.js:81265 Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
The text was updated successfully, but these errors were encountered: