react-image-compressor
react-image-compressor copied to clipboard
Often won't display the image
Hi, nice and simple, I'm just adapting this and combining it with Material UI .. but even in your demo it won't display images over 3MB. Any quick ideas why? I'll see if I can figure it out but if you know please sing out!
actually it's a little more strange, it doesn't show many images, but as soon as you start to reduce the Scale, the image will appear. You can see it do the same in your demo :)
The fix seems to be this:
After you create the img in the _drawImage method, with
let img = new Image()
img.src = imgUrl
Then place the rest of the code in this method inside the following closure:
img.onload = () => { here }
Please share your file @ticknerr