File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check if there is a gif viewer

 
rick collette
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by a "gif file viewer"?
 
rick collette
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic