| Author |
check if there is a gif viewer
|
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Hi, guys: I have the following problem: A gif file as InputStream will be fetched from database once user clicks on image link. Inside my action class, I want to check if there is a suitable gif file viewer, if yes, I want to display it. How can I do it? thanks a lot
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
|
What do you mean by a "gif file viewer"?
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
I mean any viewer (browser such as IE, Netscape, etc) that can display this image. Actually, if I click image link inside IE, it will ask me if I want to open it or save it. For Netscape, it only allows me to save it. I need to display it if the browser I am using is capable of doing it. If not, then save it.
Originally posted by Lasse Koskela: What do you mean by a "gif file viewer"?
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
How about checking whether the HTTP request's "Accept" header includes the string "image/gif"? Which version of Netscape are you talking about, by the way? You see, I haven't bumbed into a single web browser that doesn't display GIF images (except for Lynx and Links, which are character-based browsers)...
|
 |
sunitha reghu
Ranch Hand
Joined: Dec 12, 2002
Posts: 937
|
|
|
I cant understand why you getting the message do you want to save the image instead of displaying it in the browser. Can you check the html code in the page.
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
|
Have you forgotten to set the content-type header to "image/gif" when you write the image content to the ServletOutputStream?
|
 |
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Thanks for your reply: You are right. I did not make my question clear. Actually, what I wanted is to display image first. If user can click on an image link, she surely can display it on the very same browser. [ May 19, 2004: Message edited by: rick collette ]
|
 |
 |
|
|
subject: check if there is a gif viewer
|
|
|