Lines 75-80
sub new {
Link Here
|
75 |
sub _scale_image { |
75 |
sub _scale_image { |
76 |
my ( $self, $image, $maxwidth, $maxheight ) = @_; |
76 |
my ( $self, $image, $maxwidth, $maxheight ) = @_; |
77 |
my ( $width, $height ) = $image->getBounds(); |
77 |
my ( $width, $height ) = $image->getBounds(); |
|
|
78 |
my $background = $image->colorAllocate(0,0,0); |
79 |
$image->alphaBlending(0); |
80 |
$image->saveAlpha(1); |
78 |
if ( $width > $maxwidth || $height > $maxheight ) { |
81 |
if ( $width > $maxwidth || $height > $maxheight ) { |
79 |
|
82 |
|
80 |
my $percent_reduce; # Percent we will reduce the image dimensions by... |
83 |
my $percent_reduce; # Percent we will reduce the image dimensions by... |
Lines 92-99
sub _scale_image {
Link Here
|
92 |
my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) ); |
95 |
my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) ); |
93 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) |
96 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) |
94 |
; #'1' creates true color image... |
97 |
; #'1' creates true color image... |
95 |
$newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, |
98 |
$newimage->alphaBlending(0); |
96 |
$height_reduce, $width, $height ); |
99 |
$newimage->saveAlpha(1); |
|
|
100 |
$newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height ); |
97 |
return $newimage; |
101 |
return $newimage; |
98 |
} |
102 |
} |
99 |
else { |
103 |
else { |