Logic to download images