cropperjs icon indicating copy to clipboard operation
cropperjs copied to clipboard

getCroppedCanvas is producing a blank or corrupt image on some devices first time

Open crawft opened this issue 2 years ago • 9 comments

Describe the bug getCroppedCanvas is producing a blank or corrupt image on some devices first time

To Reproduce

go to https://fengyuanchen.github.io/cropperjs/ click Get Cropped Canvas (result is blank first time, subsequent times it works)

Smartphone (please complete the following information):

  • Device: Samsung S8
  • OS: Android 9
  • Chrome
  • 109

Additional context We see this only on some devices in our app (where the result is a corrupt image) and have been able to reproduce on the above device with the demo site (where the result is a blank canvas)

Screenshot_20230131-081837_Chrome

crawft avatar Jan 31 '23 08:01 crawft

Out of memory?

fengyuanchen avatar Feb 04 '23 13:02 fengyuanchen

Same thing happens on my Samsung S8 - Android 9 and Samsung A41 - Android 10. Although to recreate that it needs to be a brand new chrome tab - after refreshing the page getCroppedCanvas works fine already the first time

mutedMike avatar Feb 15 '23 15:02 mutedMike

I'm having a similar problem with my application, on chrome on an android device, only the first time you load a new browser window, except in my case the cropped image is upside down and off center.

gaileli avatar Feb 22 '23 19:02 gaileli

Reproduced on Samsung M21, Android 12 and Google Pixel 7. It only occurs on the first attempt (first time page is loaded), on following attempts works as expected.

Maybe some functions are being executed before the script is fully loaded?

miklosz avatar Apr 07 '23 13:04 miklosz

@miklosz Maybe you can try to initialize the Cropper after all things are ready (loaded or prepared).

fengyuanchen avatar Apr 09 '23 04:04 fengyuanchen

@fengyuanchen you might have misunderstood me. I reproduced this behaviour on devices as mentioned above on the demo site https://fengyuanchen.github.io/cropperjs/, so it's not my code ;-)

miklosz avatar Apr 11 '23 08:04 miklosz

@miklosz You might have to help yourself because I don't have these devices for debugging.

A possible case: The page was not loaded completely when you click the Get Cropped Canvas button.

fengyuanchen avatar Apr 15 '23 11:04 fengyuanchen

I have the same problem and try'd a lot to fix it. Nothing seems to help. I created a discusion-post some hours ago, because i don't find anything else. Some minutes ago, i saw this issue. It appears only in mobiles and seems only happen in Chrome and Brave on Samsung phones. I add here also the screenshot. Maybe it helps something? Folie1

indyger avatar May 29 '23 19:05 indyger

After a break, i wanted to retry to fix this issue and i can't reproduce it anymore on Chrome. Some days ago, a chrome-android update was released. So, on Chrome, on every of my mobile phone, it workes like a charme. On Brave, with the same chromium version, the bug is active. Really strange.....

indyger avatar Jul 25 '23 18:07 indyger