Optimized preloading of images