Added preload image function.