J
john.swilting
How to use GD::Text
The documentation says
my $gd_text = GD::Text->new(
text => 'Some text',
font => 'funny.ttf',
ptsize => 14,
);
And I have
#!/usr/bin/perl -w
use strict;
use diagnostics;
use GD;
##use GD::Text;
use CGI;
use CGI::Carp;
my $q = new CGI;
# create a new
my $im = new GD::Image(100,100);
# 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 tra $im_pngnsparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# and fill it with red
$im->fill(50,50,$red);
print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT;
print $im->png
How to make
So that both work together
The documentation says
my $gd_text = GD::Text->new(
text => 'Some text',
font => 'funny.ttf',
ptsize => 14,
);
And I have
#!/usr/bin/perl -w
use strict;
use diagnostics;
use GD;
##use GD::Text;
use CGI;
use CGI::Carp;
my $q = new CGI;
# create a new
my $im = new GD::Image(100,100);
# 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 tra $im_pngnsparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# and fill it with red
$im->fill(50,50,$red);
print $q->header( -type => "image/png", -expires => "-1d");
binmode STDOUT;
print $im->png
How to make
So that both work together