added img.onload

added img.onload: in firefox the img.width not available, image must be loaded before reading properties attempt