0

I am retrieving a base-64 string that is a representation of an image from the database. When I try to render the image in HTML, like this:

<img src="my base-64 string" />

The string gets broken up and doesn't render correctly. However, when I use the same string and attempt to render the image using ASP.NET, like this:

<asp:Image runat="server" ImageUrl="my base-64 string" />

It works successfully. A case has arisen in which I need to bind the HTML image source to a new base-64 string on the client side, therefore necessitating that I use the first method. Is there any way to accomplish this?

aquemini
  • 950
  • 2
  • 13
  • 32
  • http://stackoverflow.com/questions/1207190/embedding-base64-images – Habib Nov 13 '14 at 20:13
  • 1
    What do you mean the string gets broken up? Can you show an example (preferably with a tiny image)? – mason Nov 13 '14 at 20:13
  • Are you using *just the string* or do you actually turn it into a `data` URI? If it's just the string then what's probably happening is ASP.NET is translating it into a `data` URI for you server-side. HTML doesn't do that. So you'd need to use the full `data` URI syntax. – David Nov 13 '14 at 20:21

0 Answers0