How can I show an image base64 encoded using WebBrowser control in C#?
I used the following code:
<img src="data:image/gif;base64,/9j/4AAQSkZJRgABAgAAZABkAA7AAR
R894ADkFkb2JlAGTAAAAAAfbAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBw
...
uhWkvoJfQO2z/rf4VpL6CX0Dts/63+FaS+gl9A7bP+tthWkvoJfQODCde4qfcg
RiNWK3UyUeX9CXpHU43diOK915X5fG/reux5hUAUBftZ" />
but no image is displayed. One solution would be to save images locally and using absolute path, but this is not desirable.
Any idea?
I tried doing this for a project and IE (which the
WebBrowsercontrol will eventually use) became the limiting factor – it can only hold 32Kb-sized images. I wound up having to create an HTTP handler (.ashx) that returned the image based on a database key.edit: example – note the database handling routines are proprietary and you’d have to put in your own. The rest of the handler will show how to rescale images (if desired) and send back as a response to the browser: