Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a byte array representing a picture. I want to present the picture stored in that byte array in an aspx page. Can I do it using an image or imagemap control? If so - how? If not - what's the solution?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
341 views
Welcome To Ask or Share your Answers For Others

1 Answer

Another thing you can do which is quicker would be to not use the asp.net Image control and use the basic img element in html. So within your asp.net page, create a img element with an id of img and runat set to server.

Then you could do something like this:

<img id="img" runat="server" alt=""/>

public DataRow ClaimPhotoRow { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
    img.Src = "data:image/jpg;base64," + Convert.ToBase64String((byte[])ClaimPhotoRow[0]);

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...