in reply to display gif image
Note the use of '-s' to find the complete size of the file, which allows you to read it in one go.#!/usr/bin/perl -w use strict; use CGI::Carp; use CGI; my ($cgi) = new CGI(); my ($gif_name) = 'whatever.gif'; # Or $cgi->parameter('show') my ($image); open (GIF, $gif_name) || die "Could not open $gif_name: $!\n"; binmode (GIF); read (GIF, $image, -s $gif_name); close (GIF); binmode (STDOUT); print $cgi->header("image/gif"); print $image;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: display gif image
by dws (Chancellor) on Apr 27, 2001 at 01:06 UTC |