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 @lines = split(/\n/,$text); my $counter = 80; foreach my $line (@lines) { $im->stringTTF($black, "/home/httpd/html/ribbon.ttf", 15, 0, 50, 80,$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; }