Convert byte into image using img src

0

To convert a byte that comes from the sql database into image in the ListView I do this:

        <asp:Image runat="server" ID="Image1" CssClass="image1style" 
        ImageUrl='<%# "data:image/jpg;base64,"+ 
        Convert.ToBase64String((byte[])Eval("imagem1")) %>'/>

I would like to do the same thing but using

        <img src= " " ...

It worked like this:

 <img runat="server" ID="Img1" src = '<%# "data:image/jpg;base64," 
  + Convert.ToBase64String((byte[])Eval("imagem1")) %>'
    
asked by anonymous 23.04.2017 / 06:11

1 answer

-2

I believe you can do this by using a script:

Html

<img id="MinhaImagem" src="" />

Script

document.getElementById("MinhaImagem").src = "data:image/png;base64," + Bytes;
    
23.04.2017 / 06:38