As I see canvas concept works perfectly in Chrome but it does not work in Firefox and Safari browsers. The problem is when we upload an image, file reader reads and provides us the image properties like name, filetype and source of the image(src) which will help in image resizing. When i do console.log the properties are coming quite well in all the browsers when i tried to read img.width and img.height to assign to some other variables which i am going to use for canvas width and height they don’t work in Firefox and Safari but works fine in Chrome browser. if img variable returns 0 as width and height then the ctx.DrawImage function won’t work and it will return the image src as “data,” which is a wrong one. So later i used setTimeout to sort this problem out and everything works fine in all the browsers. The delay which we give in the setTimeout function is doing the tricky job to get the uploaded file properties.