in reply to Re: Perl "image" question...
in thread Perl "image" question...
#!/usr/bin/perl -w use strict; use CGI; use GD; my $cgi=new CGI; my $cgi_size=$cgi->param('size') || '50'; print "Content-type: image/gif\n\n"; my $gd=new GD::Image($cgi_size,$cgi_size); my $blue=$gd->colorAllocate(0,0,255); $gd->fill(0,0,$blue); binmode STDOUT; #just in case we're on NT print $gd->gif;
#!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard :cgi-lib); ReadParse(\%in); if ((defined($in{img}) && $in{img} != 1) || !defined($in{img})) { $image_file = qq~/home/user/home_dir/graphics/banners/FRHWeb_366_x +_60.gif~; open(IMG,"$image_file") or die "could not read image: $!"; binmode IMG; $image_file_code = <IMG>; close(IMG); print "Content-type:image/gif\n\n"; print $image_file_code; exit; } else { $image_file = qq~/home/user/home_dir/graphics/banners/FRHWeb_212_x +_60.gif~; open(IMG,"$image_file") or die "could not read image: $!"; binmode IMG; $image_file_code = <IMG>; close(IMG); print "Content-type:image/gif\n\n"; print $image_file_code; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Perl "image" question...
by poj (Abbot) on Feb 01, 2003 at 23:29 UTC | |
by powerhouse (Friar) on Feb 02, 2003 at 00:19 UTC |