I am getting the image size using javascript, but it won't return the correct size until after I run it a second time. I wonder why this is. Here is my code:
var img = new Image()
img.src = src
img.onLoad = alert(img.width);
This returns 0
sometimes, but after a couple times it returns the actual image width. How do I make it get the right size the first time? I thought this was the right way.