Apache-Wyrd
view release on metacpan or search on metacpan
Wyrd/Chart.pm view on Meta::CPAN
my $gd = $graph->plot($self->{'_graph_data'});
$self->_error($graph->error) if ($graph->error);
$self->_alter_graphic($gd);
$self->_error($graph->error) if ($graph->error);
#256 Color limit due to bugs in GD library
eval {$gd->trueColor(0)};
my $file = $self->{'_graphic_file'};
my $format = $self->{'_file_format'};
local $| = 1;
open OUT, "> $file" || $self->_raise_exception("Could not write file $file: $!");
binmode(OUT);
eval {
if ($format eq 'gif') {
print OUT $gd->gif();
} else {
print OUT $gd->png();
}
$self->_error($graph->error) if ($graph->error);
};
close OUT;
select OUT;
Wyrd/Site/GDButton.pm view on Meta::CPAN
my ($x, $y) = $self->_get_startpoint(@abstract);
#Then render the actual text using the calculated start point.
my @bounds = $image->stringFT($antialias * $fg, $self->{'font'}, $self->{'size'} * 5, 0, $x, $y, $self->{'text'}, {resolution => "72,72", kerning => 1});
#Shrink it down to 1/5 the rendered size.
my $final = GD::Image->new($self->{'width'}, $self->{'height'});
$final->copyResampled($image, 0, 0, 0, 0, $self->{'width'}, $self->{'height'}, $self->{'width'} * 5, $self->{'height'} * 5);
open FILE, "> " . $self->{'outfile'};
binmode FILE;
print FILE ($self->{'outfile'}=~/gif$/) ? $final->gif : $final->png;
close FILE;
}
#attempt to preserve any normal IMG or INPUT attributes
my @attrs = qw(name id action method alt src align onmouseover onmouseout onclick border height width ismap longdesc usemap class style);
my %attrs = map {$_ => $self->{$_}} @attrs;
$attrs{'src'} = Apache::Util::escape_uri($attrs{'src'});
if ($self->{'type'} eq 'input') {
$self->_data(q(<input type="image") . $self->_attribute_template(@attrs) . q(>));
( run in 0.242 second using v1.01-cache-2.11-cpan-8d75d55dd25 )