You must know that the width of an image is not available to the browsers javascript core until the image is completely loaded. I suggest to get the width of that image in a onload event of the image object.
Another issue is that you are getting the attribute width which you arent passing through the node...
To set the image onload event will be something like:
$('#imageid').load(function() {
$(this).css({ width: "", height: "" }).removeAttr("height").removeAttr("width");
var REAL_WIDTH = this.width;
})
your image's code:
<span class="frame">
<img alt="Image" id="imageid" title="Image" src="http://localhost/zapav/site/assets/questions/D41120CA-7164-11DF-A79E-F4CE462E9D80_Green_Sea_Turtle.jpg">
</span>
Also, i must say, the load event will no be triggered in cached images...