Used onloadend event to set img src.