title: How do I get natural dimensions of an image using JavaScript or jQuery?
body: <p>I have this code so far: </p>
  
  <pre><code>var img = document.getElementById('draggable');
  var width = img.clientWidth;
  var height = img.clientHeight;
  </code></pre>
  
  <p>However this gets me the html attributes - css styles. I want to get dimensions of the actual image resource, of the file.</p>
  
  <p>I need this because upon uploading an image, it's width gets set to 0px and I have no idea why or where this is happening. To prevent it I want to get the actual dimension and reset them. Is this possible?</p>
  
  <p>Edit: Even when I try to get naturalWidth I get 0 as a result. I've added a picture. The weird thing is that it only happens when I upload new files and upon refresh it's working as it should.</p>
  
  <p><a href="http://oi39.tinypic.com/3582xq9.jpg" rel="noreferrer">http://oi39.tinypic.com/3582xq9.jpg</a></p>