Getting an image's original width and height in jQuery
===

I need to get the original width and height of an image given a specific source. My current method is:

    img.tag = "<img style='display:none;' src='" + img.src + "' />";
    img.Owidth = 0;
    img.Oheight = 0;
    
    $(img.tag).load(function() {
        img.Owidth = $(this).width();
        img.Oheight = $(this).height();
    }).appendTo(img.parent());

With `Owidth` and `Oheight` being the original dimensions of the loaded image. I'm wondering if there is a better way to do this given that:

 - The image could either already be loaded, but displayed at a different size than its original size.
 - The image has not yet been loaded at all