Possible Duplicate:
How to get image size (height & width) using javascript?
Normally we can get image width with $('img').width()
or $('img').css('width')
when width is specified like the following
<img src="image.gif" width="32" height="32" />
<img src="image.gif" style="width: 32px; height: 32px" />
But if we don't specify a width:
<img src="image.gif" />
IE will return 28px, and FF will return 0px.
The problem is that we might set an image width to 28px or 0px intentionally, which would result a same number with the condition where no width is actually set.
My question is: how can we tell whether an image has been given a specific width/height or not?
edit
sorry folks, forgot one important thing: 28px on IE and 0px on FF only happens when image cannot be found (404)