Is there a way to convert a HTTP Get response into Image() object?
currently i use:
backImage = new Image()
backImage.src = "http://www.example.com/someimage.jpg";
i want to use my web api (which serves HttpResponseMessage):
public HttpResponseMessage GetImage(Guid id)
{
// my logic and image extraction
var file = new FileInfo("path-to-my-image");
var fileStream = file.OpenRead();
var response = new HttpResponseMessage { Content = new StreamContent(fileStream) };
response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");
response.Content.Headers.ContentLength = file.Length;
return response;
}
which i currently invoke via
this.http.get("http://www.example.com/api/GetImage/"+id);
When i test it in Postman i returns the response and renders the image.
I am trying to find out if its possible to convert that response and store it in the Image() object as per example.