Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying an image pulled from a database

 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm stuck on what seems like an easy problem. I want to display an image in my webpage, which would be trivially easy if the image existed in a file out on some file system that my web server could access. However, what if it exists as a blob in a database? Is my only option to write it to some temporary location and put the link to that location in my HTML, or is there something more clever I can do?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a servlet that will stream the bytes to the response after setting the appropriate encoding headers. Search for examples in this and the Servlets forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!