Thus, the warning gives undefined values ββfor width and height. I think that the values ββw and h of the image from the img.onload calculation are not passed to the returned values, or they can return w and h until when onload calculates them:
function getMeta(url){ var w; var h; var img=new Image; img.src=url; img.onload=function(){w=this.width; h=this.height;}; return {w:w,h:h} }
How can I show a warning about the correct width and height?
http://jsfiddle.net/YtqXk/
javascript image width height
Wonka Jul 11 2018-12-12T00: 00Z
source share