Answer the question
In order to leave comments, you need to log in
How to display images received from a request with Content-Type: application/image in Angular2?
Perhaps it would be easier if they were not in the text, but the point is that in the markdown text there are pictures that are indicated not by the address, but by the id of the picture. I make a request to the address, I get a response like application/image .
Everything I screwed up:
.subscribe(
(data:any) => {
let image = window.URL.createObjectURL(new Blob([data.arrayBuffer()], {
type: "application/image"
}))
return '<img src="'+image+'">';
}
);
Answer the question
In order to leave comments, you need to log in
the blob constructor is not cross-browser friendly, if it doesn't confuse (but it should) then it can be converted to base 64 which can be shoved into the src of the photo
var reader = new window.FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() {
base64data = reader.result;
console.log(base64data );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question