Updated to set the content type of the image before sending the response.