download and write out an image in cache_image