add preload image function