File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Displaying byte array as image using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Displaying byte array as image using javascript" Watch "Displaying byte array as image using javascript" New topic
Author

Displaying byte array as image using javascript

vamshi gurudu
Greenhorn

Joined: Sep 23, 2008
Posts: 21
HI,

I want display byte array in to image using java script, any help.

Actually i am inserting image in to mysql database using blob, image is converted to byte array.
I am retrieving all the table values using json array and displaying using javascript, in the json array i am adding this image byte array also.
I am able to retrieve the other values, but not able to display this byte array as image.


Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

The byte array is useless on the page. You'll need to create an image tag and have it reference a servlet that returns the image data as it's response.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you want to make this work in all browsers, you need to have the server return the image.

You can always set the src of the image with a get request that can retrieve the image from the database


Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying byte array as image using javascript