|
|
sybperl-l Archive
Up Prev Next
From: floyd at interactive dot net
Subject: GIF to Browser - HERE IS THE SOLUTION
Date: Sep 15 1997 7:58PM
I finally figured it out - and thanks to all for their input
!
It seems the problem was perl, not http related.
I created the following script in the cgi-bin directory,
and called it show-gif:
#!/usr/bin/perl
print "Content-Type: image/gif\n\n";
$/ = 0; # force perl to read to end of current file.
# undef($/) works also
$| = 1; # MUST force the buffer to be flushed, or the browser will sit
# and wait for more data (STOP button will stay activated in
# Netscape)
open(FILE,"whatever.gif");
print ();
close FILE;
exit;
you can use this script either directly from the browser:
http://xxx.com/cgi-bin/show-gif
or within an image tag:
Its easy to extend this script to recognize different image types and
to accept a filename as input.
Use it in good health!
floyd@interactive.net
|