made the code required to compress and download images