Here I have shown, how Java script can be use to show a image using binary data (binary data may come from a data base).
Java script function
function showBinaryImage(binaryImageData){
var html = null;
html+="<table><tr><td>";
html += "<img width=\"40%\" height=\"40%\" src=\"data:image/png;base64," + binaryImageData.replace(/^\s+|\s+$/g, '')+ "\"/>";
html+="</td></tr></table>";
document.getElementById('content_div').innerHTML = html;
}
here 'content_div' is the id of a html div element inside the html.
<div id="content_div" ></div>
Now binary image should show in your web page.
1 comment:
Hi Kasun's,
This is what i actually need. Thanks a lot for that code.
Hart
Post a Comment