Image URL fix

Image URLs were broken after img.onload event. They now use the src of the loaded image.