A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Display IMG from Blob database field ?
Joined: Aug 07, 2003
Dec 02, 2004 06:46:00
I would like to create a
where the user can click and display a picture in a new browser window.
Pictures are stored in database as BLOBs.
I succesfully managed to code this in a
with a simple
straight forward the
as a new window.
The problem is that i cannot handle the window size according to the
's real size... The browser (IE) use a default size. Far too big most of time
Does anyone know a trick to specify the size of the new window ?
Or maybe there is another way to solve the problem...
- I don't know the size of the image before the user click on the link
- I need to handle a binary Stream since I don't have possibility to store the picture as temporary file on the server
Thanx in advance
[ December 02, 2004: Message edited by: Franck Tranchant ]
Author and ninkuma
Joined: Jan 10, 2002
Dec 02, 2004 09:12:00
I'll assume that you are showing the image via an <img> tag that references the servlet that fetches the image from the DB.
So here's one approach:
1) When the link is clicked, a request is submitted to a hidden iframe on the page. This way, you can submit something to the server without changing the current page.
3) The URL specified for the new window references a JSP that contains the <img>tag that displays the image.
Using this method you need two server trips per image: one to look up the size and one to actually display the image.
Asking smart questions
Books by Bear
Joined: Aug 07, 2003
Dec 06, 2004 05:48:00
I solved this issue using another approach :
Instead of providing the user a link pointing on the Servlet (<A TARGET="_blank" HREF="retrievePicture?someParam=xxx">) , I provide a link pointing on a JSP.
In this JSP, the HTML tag <IMG> is included similar to this one : <IMG SRC="retrievePicture?someParam=xxx">
[ December 06, 2004: Message edited by: Franck Tranchant ]
I agree. Here's the link:
subject: Display IMG from Blob database field ?
XML display in browser
Problem with Target Attribute
open popup window and insert chinese
How to display database picture in thumbnail view ?
Any ideas on control session management
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015