Scott R. Godin wrote:
JupiterHost.Net wrote:
hello list :)
Anyone have any idea why the last line doesn't print anything?
I get no errors and have eval'ed it with no errors. I've also tried with ->png and ->jpeg also with the same results...
I think I'm doing it right according to http://search.cpan.org/~lds/GD-2.19/GD.pm
All it outputs is the header:
$ ./gdtest.pl Content-type: image/gif
$
Here's the code:
#!/usr/bin/perl
use strict; use warnings; use GD;
my $image = GD::Image->new(100,50); my $white = $image->colorAllocate(255,255,255); $image->transparent($white);
my $fontcolor = $image->colorAllocate(0,0,0); my $font = GD::Font->Small();
print "Content-type: image/gif\n\n"; $image->string($font,2,10,'hello world',$fontcolor); #$image->rotate90; print $image->gif;
TIA!
make sure that GD and libgd were built with gif support.
They were, as I can go the animated gif example in the docs perfectly.
I'd also tried $img->png and $img->jpeg :)
you may also wish to use
binmode STDOUT;
before you print
Yeah, same results with that. I will need to do that but I was just trying to get *something* to get printed ;p
I've added it to my test script and did the othe types as well and removed the content type header so that doesn't confuse the issue.
#!/usr/bin/perl
use strict; use warnings; use GD;
my $image = GD::Image->new(100,50); my $white = $image->colorAllocate(255,255,255); $image->transparent($white);
my $fontcolor = $image->colorAllocate(0,0,0); my $font = GD::Font->Small();
$image->string($font,2,10,'hello world',$fontcolor); binmode STDOUT;
print "PNG\n"; print $image->png;
print "\nGIF\n"; print $image->gif;
print "\nJPEG\n"; print $image->jpeg;
Gives:
$ perl Sites/gdtest.pl PNG
GIF
JPEG $
Weird eh? Any ideas?
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>