1) First I read in the jpg�s as Blobs. For each Blob value I convert it to a BinaryStream which I write to a file ( FileOutputStream ).
2) Then I preview the jpg in a browser with the HTML tag <img src="PATH_TO_FILE.jpg">. I just make a reference to the directory and file...
That works fine!
The problem is that I don�t know how to delete all those files that I write to the directory after reading the blob from the database.
Do I have to make a batch job to delete all the files or is it possible to show the jpg�s in the browser without writing the blob to a file first? [ November 18, 2004: Message edited by: Jeppe ]
posted 11 years ago
You can send an image to a browser without writing a file using a servlet. The response type of the servlet would be the image mime type (e.g. image/png for png files) and instead of writing the image data to a file output stream you would send it to the servlet's output stream.
in the servlet it might look something like this...
If you call this servlet as the URL for your image then the browser should display it