Added image download functionality to the API and to image attachments