tame1 has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately, the image is only showing " 'I " (The test#!/usr/local/bin/perl -w # Simple image creation script - hopefully use strict; use GD; use CGI qw(:standard); ######################################################### # Set up all the globals # ######################################################### # create a new image my $im = new GD::Image(400, 200); my $query = new CGI; # allocate some colors my $white = $im->colorAllocate(255,255,255); my $black = $im->colorAllocate(0,0,0); my $red = $im->colorAllocate(255,0,0); my $blue = $im->colorAllocate(0,0,255); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,399,199, $black); ########################################################## # End of the globals ########################################################## # MAIN # ########################################################## my $text = $query->param("text"); make_image($text); exit(0); ########################################################## # Make an image from the lines in the array sub make_image { my $text = shift; my $counter = 80; my @lines = split(/\n/,$text); foreach my $line (@lines) { $im->stringTTF($black, "/home/httpd/html/ribbon.ttf", 12, 0, 1 +80, $counter, "$line"); if ($@) { $im->string(gdSmallFont, 50, 150, "$@", $black); die "Cannot print!$!\n"; } $counter += 10; } binmode STDOUT; print $query->header(-type=>'image/png'); print $im->png; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: a newbie to GD
by Ovid (Cardinal) on Nov 20, 2000 at 21:51 UTC | |
|
Re: a newbie to GD
by merlyn (Sage) on Nov 20, 2000 at 21:42 UTC |