File: //scripts.20110531.215904.25158/checkgd
#!/usr/bin/perl
my $hasgd = 0;
eval {
require GD;
require GD::Graph::pie;
require GD::Graph::bars;
require GD::Graph::hbars;
require GD::Graph::Data;
my $im = new GD::Image(18,18);
my $color = $im->colorAllocate(0,0,0);
my $d = $im->png();
if ($d ne "") {
@KEYS=("1","2");
@VALUES=("1","2");
my @data = (\@KEYS,\@VALUES);
my $my_graph = new GD::Graph::pie( 120, 120 );
$my_graph->set(
axislabelclr => 'black',
'3d' => 0,
pie_height => 16,
l_margin => 0,
r_margin => 0,
start_angle => 235,
transparent => 1,
);
$d = $my_graph->plot(\@data)->png;;
$hasgd = 1;
}
if (-d '/usr/local/cpanel/etc/testimgs') {
my $testjpeg = GD::Image->newFromJpeg( '/usr/local/cpanel/etc/testimgs/testimg.jpg' , 1 );
if (! $testjpeg) {
print "missing jpeg support\n";
die "GD: Error loading test jpeg";
}
my $testgif = GD::Image->newFromGif('/usr/local/cpanel/etc/testimgs/testimg.gif');
if (! $testgif) {
print "missing gif support\n";
die "GD: Error loading test gif";
}
my $testpng = GD::Image->newFromPng( '/usr/local/cpanel/etc/testimgs/testimg.png', 1 );
if (! $testpng) {
print "missing png support\n";
die "GD: Error loading test png";
}
}
};
if ($hasgd) {
print "ok\n";
} else {
print "missing\n";
}