Owen wrote:

--------------------------insert---------------------------
open (OUT,">GD.png");
my $img = $image->png;
print OUT "$img";
--------------------------end insert---------------------------

It worked for me, try modifying the script a la above and see if it produces a GD.png file

indeed.

#!/usr/bin/perl
use warnings;
use strict;
use GD;

my $image = GD::Image->new(100,50);
my $white = $image->colorAllocate(128,128,255);
#$image->transparent($white);

my $fontcolor = $image->colorAllocate(0,0,0);
my $font = GD::Font->Small();

print "Content-type: image/png\n\n";
$image->string($font,2, 8,">hello world...",$fontcolor);
$image->string($font,2,20," Would you like",$fontcolor);
$image->string($font,2,32," to play a game?",$fontcolor);

my $img = $image->png or die "$!";
binmode STDOUT;
print $img;

apparently it's necessary to extract it to a scalar first; plus this way you can test for whether the method is supported in the compiled libgd and error if not,

$ perl gif.pl > gif.gif
libgd was not built with gif support
        ...propagated at gif.pl line 19.

or,

"The image 'http://localhost/cgi-bin/hello.cgi' cannot be displayed, because it contains errors." ;) (yes that works, try it with the above code, which should work fine and display an image. :)

--
Scott R. Godin
Laughing Dragon Services
www.webdragon.net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to