I have this image that I receive as byte[], but then as I try to display it using the src
attribute of the img
element as data:image/png;base64,[byte array here]
it displays System.Byte[]
and not the actual array, therefore the image does not get displayed.
Below are two images of my code and the result of it
CodePudding user response:
You need to convert the byte array to base64 string. You can use Convert.ToBase64String
method.
<img src="data:image/png;base64,@Convert.ToBase64String(card.Image)" />