My google fu in failing me. How do I use Perl to serve up an already generated image?
Example:
<http><body><img src="getimage.pl"></body></html>
What goes in getimage.pl?
My google fu in failing me. How do I use Perl to serve up an already generated image?
Example:
<http><body><img src="getimage.pl"></body></html>
What goes in getimage.pl?
WWW FAQs: "How do I output images from a Perl/CGI or PHP script" should get you going in the right direction. You will have to forgive me for not answering your question directly as I haven't touched Perl in about 5 years.
Here you go:
#!/usr/bin/perl -w
my $file = "inner-nav.gif";
my $length = (stat($file)) [10];
print "Content-type: image/gif\n";
print "Content-length: $length \n\n";
binmode STDOUT;
open (FH,'<', $file) || die "Could not open $file: $!";
my $buffer = "";
while (read(FH, $buffer, 10240)) {
print $buffer;
}
close(FH);
Something like this ...
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $gfx='';
$gfx = makeImage();
print CGI::header( type=>'image/png',
expires=>'+1m',
content_length=>length($gfx)});
print $gfx;