• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying byte array as image using javascript

 
vamshi gurudu
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic