Displaying a tif image to the user.

  • Thread starter Srinivas Chundi
  • Start date
S

Srinivas Chundi

I have to display tif images using .asp page. I have tried to read the image
as a binary file and stream it to the browser. The relevant code is as
follows. Unfortunately, the display on the browser is a lot of gobledygook.
How can I ensure that the image displays correctly in the browser?

Dim objStream
Dim FilImage, FolImage, strFilImage
Dim adTypeBinary adTypeBinary = 1

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile "\\servername\image.tif"
Response.ContentType = "application/tif"
'I have also tried "image/tif"
Response.BinaryWrite
objStream.Read
objStream.Close
Set objStream = Nothing

Currently, if the user wants to view a .tif image, double clicking on the
image file launches a software known as "Imaging for Windows Preview". If ie
explorer can't display .tif images, it would be ok if the asp page can
somehow lauch this software on the users machine and display the image in
it.
Thanks a lot
-M
 
T

Tom B

ASP can't launch anything on the user's browser.
IE can't display .tif files, the Imaging for Windows Preview is the default
viewer in Windows 2000 (and earlier?) and Windows XP's default is the Fax
and Picture Viewer.

If you want the tif's to display in the browser you have to convert them to
a format that the browsers will support (JPG, GIF, PNG come to mind)
 
S

Srinivas Chundi

It is ok if the browser cannot display the .tif files.

If the asp can be made to spit out the tif file as it is, that is adequate.
I am hoping the browser will then prompt the user to open or save the file.
(like say when we are downloading a .zip file form the net) Clicking 'open'
should then launch the default viewer for the tif file.

When I put a hyperlink in a simple html page to the physical location where
the file is located, it actually does something like that. However, I am not
allowed to let the user see where the file is physically located and so I am
hoping asp can read it and stream it to the user in a binary format.
Thanks
-M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,039
Members
48,768
Latest member
first4landlord

Latest Threads

Top