title: Get width height of remote image from url
body: <p>So the alert gives undefined values for the width and height. I think the w and h values of the image from the img.onload calculation is not being passed to the values to return, or it may be returning w and h <strong>before</strong> the onload calculates them:</p>
  
  <pre><code>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}    
  }
  
  // "http://snook.ca/files/mootools_83_snookca.png" //1024x678
  // "http://shijitht.files.wordpress.com/2010/08/github.png" //128x128
  
  var end = getMeta("http://shijitht.files.wordpress.com/2010/08/github.png");
  var w = end.w;
  var h = end.h;
  alert(w+'width'+h+'height');
  </code></pre>
  
  <p>How can I have the alert show the correct width and height? </p>
  
  <p><a href="http://jsfiddle.net/YtqXk/">http://jsfiddle.net/YtqXk/</a></p>