Click here to Skip to main content
15,847,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am storing a note created with images in my SQL DB.

The html is stored as string like so
eg:
C#
<div class="WordSection1">
Image 1<br>
<img width="237" height="97" id="Picture_x0020_2" src="cid:image001.png"><br></div>


And the content of image0001.png is stored as a byte array.

how do I display the note with the image displayed
right now it displays a 'X' where the image should be

Please assist. Thanks
Posted
Comments
DamithSL 25-Mar-15 4:53am    
can you update the question with the code, how you save and load your note content with image?
ASJ_SA 25-Mar-15 5:10am    
The code that creates the html is like so
Dim strbHTML As New Text.StringBuilder
For Each Note In Notes
strbHTML.Append("<table><tr><td>" & Note.NoteMessage & "</td></tr><br></table>")
Next

the NOte.NoteMessage is html that is saved as string in the DB.
so essentially it will have the string "<img width="237" height="97" id="Picture_x0020_2" src="cid:image001.png"><br>"

The image0001.png itself is stored in a table as a byte array.

Thnx

1 solution

GOt it..
If anyone else is looking for this
add a webbrowser control to your page
and do this

VB
Dim array() As Byte = File.ReadAllBytes("C:\image.PNG")


Dim base64string As String = System.Convert.ToBase64String(array, 0, array.Length)
Dim str As String = "<div class=WordSection1>Image 1<br><img width=237 height=97 id=Picture_x0020_2 src=data:image/png;base64," + base64string + "></div>"

WebBrowser1.DocumentText = str
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900