title: Get image width height javascript
body: <p>Well, I have this code:</p>
  
  <p><a href="http://jsfiddle.net/hv9gB/3/" rel="nofollow">http://jsfiddle.net/hv9gB/3/</a></p>
  
  <pre><code>    (function() {
  
      var img = document.getElementById('my_image');
  
      // Original
      var width, height;
  
      // Display
      var d_width = img.width;
      var d_height = img.height;
  
      var updateDetail = function() {
          document
              .getElementById('display_size')
              .innerHTML = 'Display Size: ' + d_width + ' x ' + d_height;
  
          document
              .getElementById('native_size')
              .innerHTML = 'Original Size: ' + width + ' x ' + height;
      };
  
      // Using naturalWidth/Height
      if (img.naturalWidth) {
          width = img.naturalWidth;
          height = img.naturalHeight;
  
          updateDetail();
      } else {
          // Using an Image Object
          img = new Image();
          img.onload = function() {
              width = this.width;
              height = this.height;
  
              updateDetail();
          };
          img.src = 'http://lorempixel.com/output/nature-q-c-640-480-3.jpg';
      }
  
  }());
  </code></pre>
  
  <p>And that is my site:</p>
  
  <p><a href="http://dhems.x10.mx/" rel="nofollow">http://dhems.x10.mx/</a></p>
  
  <p>But on my site isn't working show the width and height of image</p>
  
  <p>Why?!?!</p>