Possible Duplicate:
Is it possible to put binary image data into html markup and then get the image displayed as usual in any browser?
So for example I have an image like:
\x89PNG\r\n\u001A\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0001@\u0000\........
Is there any way that from that I can show the image in a img tag?
You can't show it natively without assistance to convert it.
If you base 64 encode it instead, you can.
<img src="data:image/png;base64,iVBrkJggg==" alt="Base 64 encoded!" />
Further Reading.
You can't do that with HTML only. The img tag can only display images via the URL supplied in the src attribute. You could set src to the URL of a page on your server that prints the hex string. For example:
<img src="myimage.php" />
myimage.php:
header("Content-type: image/png")
print $hex_string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With