Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Import a .tif image into A Web Page?

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
0
0
US
Hi,

Just getting started in my project. What's the best way to feed in documents (from a file server) into an HTML page?
The goal is to take docs from a file server (either text or .tif images) and have them represented as links on a web page that the user can click on and be redirected to Adobe to open the doc.

I'm just looking for a general answer, like, "You'll have to incorporate ASP/Java." I think I will have to use Java. I'm just not sure to what extent.

Any help is greatly appreciated. Then begins the long climb.....

Thanks,
scripter73

Change Your Thinking, Change Your Life.
 
We've build a small image database in an oracle db with a servlet delievering the data to webbrowsers. Also to upload is done by a servlet page.

The images are then referenced by their database ID give by an url parameter to the servlet.

Not very difficult in java if you have a servlet container.

If you want to read the data from the file system this might be a little more tricky but not much.

-Henning
 
Hi ihbrune,

Thanks for your response. I already have the image database/file system. I just need to get access to it. I doubt I'll have to create something like that.

You're right about accessing the images based on a database ID from the URL. Our client will have a login/password and after a few navigations, there will most likely be doc ids associated with the URL. So I just pass that to a servlet? I'm new to Java and I'm learning the syntax, etc. so the servlet issue is just a black box to me right now.

However, won't I need an Image Editor or Optical Character Recognition software to take the .TIF files and put the images in a format that the web browser likes (ex., GIF/JPG)? Or can the servlet do all of this? That's where I'm getting confused.

I appreciate any help you can offer.
scripter73
Change Your Thinking, Change Your Life.
 
You can write a servlet that takes the TIFF image and translates it on the fly into a JPEG image which is then streamed to the client, but unless you have a very powerfull computer that might take too long (I'd certainly build in a system where the servlet also stores the generated JPEG and streams that instead afterwards).
For application performance it would be advisable to have the conversion of TIFF into JPEG be handled as a batchprocess outside the main application if at all possible.
If the converter were to run for example once an hour you'd never be more than an hour out of date.
 
Thanks for your help. I got derailed onto another topic. I have to figure out a way to access a VB program that will first obtain the .TIF documents. But I'll look into what you're suggesting when I get to that point.

Many thanks for your response.

scripter73
Change Your Thinking, Change Your Life.
 
Java has all sorts of ImageInputStream classes and File System Objects that can handle/convert images.

Here are a few class samples from the 1.4 API in relation to the ImageIO class and IO.Reader class..

public class InputStreamReader extends Reader
An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.



InputStreamReader(InputStream in, CharsetDecoder dec)
Create an InputStreamReader that uses the given charset decoder.


public final class ImageIO extends Object
A class containing static convenience methods for locating ImageReaders and ImageWriters, and performing simple encoding and decoding.


getImageTranscoders(ImageReader reader, ImageWriter writer)
Returns an Iterator containing all currently registered ImageTranscoders that claim to be able to transcode between the metadata of the given ImageReader and ImageWriter.

createImageInputStream(Object input)
Returns an ImageInputStream that will take its input from the given Object.

createImageOutputStream(Object output)
Returns an ImageOutputStream that will send its output to the given Object.

You can thread a standalone Java application to sit on a specific file directory and convert images to your desired type on the fly. Or you can have a Servlet pass a directory path to the same application to convert your image.

I prefer my first suggestion cause sometimes clients are very picky about their server side HTML scripting languages. This way you can use anyone you like. Cold Fusion has some cool JRUN stuff that can create instances of Java apps..

Here is a link to suns API, which has tons of little goodies just like the MSDN my other favorite place:

Hope this helps. :eek:)

Bygs
 
It really does. Let me check it out.

I'll let you know how it goes. Thanks!


Change Your Thinking, Change Your Life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top