The binary image data is stored in mongodb collection as shown below
image:Binary('XXXXXXXXXXX...', 0)
when I am trying to display it in html
<div > <img src="data:image/png;base64,{{person.image}}"/></div>
It gives me this error when executing:
net::ERR_UNKNOWN_URL_SCHEME png;base64,[object Object]:1
I didn't convert the binary data to base64
CodePudding user response:
Binary is class that has only the default toString
method.
To get the data URL string you will probably need to use the Binary class getData
method to return a byte array, and then convert that to a base64 string as described here: https://stackoverflow.com/a/33552306/2282634