Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello

I have this HTML string. I want to embed the image in the HTML content so that if in future if i will delete the image from D:/Icons/Logic/sign_up_16.png then still i can use the saved HTML string and get the image.


<P>
<SPAN style="COLOR: #24ea51">
<IMG src="file:///D:/Icons/Logic/sign_up_16.png">
Rahul</SPAN>
</P>



Thanks
Posted

1 solution

Tha only way I know for this to work is to embed the picture as Base64 encoded text.

You can see this tutorial on how to embed Base64 images in html: http://www.websiteoptimization.com/speed/tweak/inline-images/[^]
 
Share this answer
 
v2
Comments
RahulVerma116 24-Jul-12 3:01am    
But My string is not like that
<IMG SRC="data:image/gif;base64,RAAA...more data.....">

it shows the file
StianSandberg 24-Jul-12 3:04am    
no, not yet. But if you want to embed images in html, you will have to Base64 encode them and add the base64 encoded text as your img src.
You can use a tool like this to to the job for you. Just upload image and it will produce a img-tag for you : http://webcodertools.com/imagetobase64converter/
RahulVerma116 24-Jul-12 3:12am    
Can you give any example of Base64 encode for the image?
StianSandberg 24-Jul-12 3:20am    
Just use the link I gave you, upload an image and you will get the IMG tag you need with the base64 encoded imagedata in it. Pretty easy to use :)
StianSandberg 24-Jul-12 3:21am    
Here's an example.
This image is 905 bytes.

<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAB3RJTUUH2AQPDSoCFue8IwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAARnQU1BAACxjwv8YQUAAAMYSURBVHjafVJLiBxVFD2v3qtfV8/YnUzPNNFMYAYUguCYIY2fgAlKxoVCQEQIBncSXWaTRTYJiESyE1y5zEpUUHGpGYIyCwmG+JkMJOMYe6Z7pn9VXd3V9XtVlVs1BMGAl3pVD+qec8+59zI8Huy5V978QNf0a0iguwOn43v+Xu3wzOlbN77t/jdZvHfuXX7PnlTjKDSZomQyZumRxWc/27rz6/oLKyunKpXK+Z3NrStrqz99Q/kvP0ZwZ3tw6fCh+pWyZSEIfIwnAc6fWsXVB+bRH7//bk8mGY4tvQjOxs/Mzj9/UhFqWy2JdvOPNbeQe/LM2e2LFy48GQQhhsMh+gMbtj1A4DnY67pw7DHef2MdX/+Q4OfbFuIwQBJLpAqclLMPhWmatcWFBYRxRFU4YinheR6coYuh48AeDHG720B13sYJqw/XHeHuvSYGnX4lyqLPhUZhGgZG4zEBJ4iiCGmaQWEMpZIFRqSqqkGno2QcMgL8yQjTZR1927MEAfudXv+gZU6RIwUMPnzfL8hG4wk8qjh0x3BHHnKbQRTD0ASmnyhjb7eVCULd+PjaJ28fqFRRMko4Mr+ApxcPwTR0KMpBStYhNBWCCwhFge3kvWMoT1u55ZBv3f3tyxOvrVw+vryMmNibO20s169jafYLDP7+Cp9eH6HX6SIMY0xoQut/bpDCSaFgt9UOcwWF5ywDDlSrsKwyVm9VcPMX0DQC1Osz6HY7uH//L/IekCqG+uwc0iwlVaoiHi0E5xxMcCCS8LWXKDlGaMTQaGy1mRlMWVMI/QjN5j8EzsCSYgvifwmo2w6NLSIbZVKha/uSfc7ob0D2JOXn9321OQnd04JAygSdXgdztblizr3eAO5wVBCEQUSkEpKWJ0kS7MOywjZFUhA0W62bm5sPGpZhmpxcmYaJ/CtUUVTK8pMWzc8feinwRj411m+yRxZeP/0qH+tP1ZIkWspk8hYypSGlPKpxTeRLpGoGgTl229ukzEev2/pdV8U5hv+JxvEzemgks2koj8Vx8o7C1QZLsoWd1tbVerX60cbG2uQhJfCRLMjAiAgAAAAASUVORK5CYII=" />

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