Because of the way I'm normally getting image data normally from an HTTP response supplying image data from the database, it is a base64 encoded value of the image. If it isn't present, I am trying to substitute a default image.
An example of the html to display the image is like:
<img [src]="'data:'+sample.mimetype+';base64,'+sample.value"
alt="" width="75%" />
The call I'm currently making to retrieve the image returns a blob. (note I'm currently looking at the entire response only to help try to figure out what I am getting). If the answer is using a different type of image response, I'm all ears. Here is the current call to retrieve the image from the file system.
return this.httpClient
.get<any>('./assets/images/face-not-avail.jpg', {observe: 'response', responseType: 'blob' })
.map(response =>{
console.log('face response ' + response);
return response.body;
})
.catch(this.errorHelperService.handleError);
Here is the contents of the image response: enter image description here
But I am having trouble figuring out how to turn that blob into the type of base64 encoded value attrubute that I normally am dealing with. I won't list everything I have tried... But I can't seem to get access to the blob data. The blob type is image/jpeg as expected.
I've been looking around, but nothing seems to fit.
Any advice would be greatly appreciated.