#!/usr/bin/perl use strict; use warnings 'all'; # we need GD eval { require GD }; unless ($@) { # if GD is installed, call GD::import import GD; # and start start(); } else { # exit with errorlevel > 0 exit(1); } # all was right, so exit with errorlevel == 0 exit(0); # start here(GD is installed) sub start { print "Content-type: image/png\n\n"; my $image = new GD::Image(100,20); my $rot = $image->colorAllocate(255,0,0); my $weiss = $image->colorAllocate(255,255,255); $image->string(GD::gdMediumBoldFont(),3,5,"Test",$weiss); binmode STDOUT; print $image->jpeg; } # start __END__