Lines 75-81
sub PutImage {
Link Here
|
75 |
# Check the pixel size of the image we are about to import... |
75 |
# Check the pixel size of the image we are about to import... |
76 |
my $thumbnail = _scale_image( $srcimage, 140, 200 ) |
76 |
my $thumbnail = _scale_image( $srcimage, 140, 200 ) |
77 |
; # MAX pixel dims are 140 X 200 for thumbnail... |
77 |
; # MAX pixel dims are 140 X 200 for thumbnail... |
78 |
my $fullsize = _scale_image( $srcimage, 600, 800 ) |
78 |
my $fullsize = _scale_image( $srcimage, 600, 800, { force_true_color => 1 } ) |
79 |
; # MAX pixel dims are 600 X 800 for full-size image... |
79 |
; # MAX pixel dims are 600 X 800 for full-size image... |
80 |
$debug and warn "thumbnail is " . length($thumbnail) . " bytes."; |
80 |
$debug and warn "thumbnail is " . length($thumbnail) . " bytes."; |
81 |
|
81 |
|
Lines 156-164
sub DelImage {
Link Here
|
156 |
} |
156 |
} |
157 |
|
157 |
|
158 |
sub _scale_image { |
158 |
sub _scale_image { |
159 |
my ( $image, $maxwidth, $maxheight ) = @_; |
159 |
my ( $image, $maxwidth, $maxheight, $params ) = @_; |
160 |
my ( $width, $height ) = $image->getBounds(); |
160 |
my ( $width, $height ) = $image->getBounds(); |
161 |
$debug and warn "image is $width pix X $height pix."; |
161 |
$debug and warn "image is $width pix X $height pix."; |
|
|
162 |
|
163 |
my $true_color = delete $params->{force_true_color} || $image->trueColor; |
162 |
if ( $width > $maxwidth || $height > $maxheight ) { |
164 |
if ( $width > $maxwidth || $height > $maxheight ) { |
163 |
|
165 |
|
164 |
# $debug and warn "$filename exceeds the maximum pixel dimensions of $maxwidth X $maxheight. Resizing..."; |
166 |
# $debug and warn "$filename exceeds the maximum pixel dimensions of $maxwidth X $maxheight. Resizing..."; |
Lines 179-185
sub _scale_image {
Link Here
|
179 |
and warn "Reducing image by " |
181 |
and warn "Reducing image by " |
180 |
. ( $percent_reduce * 100 ) |
182 |
. ( $percent_reduce * 100 ) |
181 |
. "\% or to $width_reduce pix X $height_reduce pix"; |
183 |
. "\% or to $width_reduce pix X $height_reduce pix"; |
182 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, $image->trueColor ) |
184 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, $true_color) |
183 |
; # if third is set, creates true color image |
185 |
; # if third is set, creates true color image |
184 |
$newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, |
186 |
$newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, |
185 |
$height_reduce, $width, $height ); |
187 |
$height_reduce, $width, $height ); |
186 |
- |
|
|