i have a javascript that receives binary image data and i wanted to show it on the html page. how do i use javascript to convert it to an image object? Is there any better ways to do this? Thanx in Advance
Can you clarify what do you mean by "binary image data" ? Is the image encoded in an acceptable format such as jpeg, gif or png and available through a url from your site that the javascript tries to fetch?
Thnks for the response. I am storing image (Binary Format) in SQL database, which is retreived from the database to display on a html file. i can get the data fromthe database to the html file using javascript. how do i convert the binary image data back to image object. Thanx
You can create an image object in javascript using: var image=document.createElement("img"); image.src="http://www.yourdomain.com/the_image.php"; and add it to the body of your document by: document.body.appendChild(image); You should make sure that the php script (or any other language you may use) sets the response content type correctly to 'image/jpeg' or 'image/gif' in order that it will work on all platforms. For instance, in php, before you output the response, you should call: header("Content-Type: image/jpeg");