tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avi Deitcher <>
Subject Re: Simple question, but can't figure out answer
Date Tue, 11 Jul 2006 21:07:20 GMT

Unless there is a particular reason (e.g. dynamically created images),
why are you reading image files directly in Perl, then dumping the
output? You should just use CGI to generate HTML that looks like this:

<img src="/images/some/path.gif"/>

Even if you want to dynamically *choose* the image, you are better off
having CGI/JSP/etc. dynamically fill in the src <img
src="${some_dynamic}"/> or <img src="<%= someVal %>"/> rather than
actually literally feeding the image.

Mead, Jennifer L - VSCM wrote:

>I am trying to create some cgi pages for my company.  Or I should say I
>have created some and now just want to add a header graphic in the main
>page.  Nothing fancy.  However, I cannot get my image to display, no
>matter how I embed the darned thing.  I can't even get regular html to
>display from our installation.  Is it a configuration thing?  Or am I so
>green I just don't get it?  (feel free to flame).  Here is the only code
>I can get running that displays the image:
>#!/usr/local/bin/perl -w
>use warnings;
>use CGI qw/:standard/;
>use CGI::Carp qw( fatalsToBrowser );
>use constant BUFFER_SIZE => 4_096;
>use constant IMAGE_DIRECTORY => "/images";
>$|=1 ;
>$q = new CGI;
>print $q->header( -type => "image/gif" );
>binmode STDOUT;
>my $buff = "";
>my $image = "icc-logo.gif";
>local *IMAGE;
>open IMAGE, IMAGE_DIRECTORY . "/$image" or die "cannot open file $image:
>while ( read( IMAGE, $buff, BUFFER_SIZE ) ) {
>   print $buff;
>} close IMAGE;
>All good, it looks fine.  However I cannot use this because then I
>cannot display anything else, or at least I cannot figure out how to.
>Any help is appreciated.  I have been trying all kinds of things, so
>many I cannot recall half of the things I have tried.  Truly frustrated
>from lack of knowledge.
>Jennifer L Mead
>ICC Operations Sr Sys Engineer
>Con-way Enterprise Services
>503.450.8578 		desk
>503.550.6589		cell

Avi Deitcher

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message