View | Details | Raw Unified | Return to bug 8088
Collapse All | Expand All

(-)a/Koha/CoverImage.pm (-4 / +3 lines)
Lines 74-81 sub new { Link Here
74
sub _scale_image {
74
sub _scale_image {
75
    my ( $self, $image, $maxwidth, $maxheight ) = @_;
75
    my ( $self, $image, $maxwidth, $maxheight ) = @_;
76
    my ( $width, $height ) = $image->getBounds();
76
    my ( $width, $height ) = $image->getBounds();
77
	$image->alphaBlending(0);
77
    $image->alphaBlending(0);
78
	$image->saveAlpha(1);
78
    $image->saveAlpha(1);
79
    if ( $width > $maxwidth || $height > $maxheight ) {
79
    if ( $width > $maxwidth || $height > $maxheight ) {
80
80
81
        my $percent_reduce;    # Percent we will reduce the image dimensions by...
81
        my $percent_reduce;    # Percent we will reduce the image dimensions by...
Lines 87-94 sub _scale_image { Link Here
87
        }
87
        }
88
        my $width_reduce  = sprintf( "%.0f", ( $width * $percent_reduce ) );
88
        my $width_reduce  = sprintf( "%.0f", ( $width * $percent_reduce ) );
89
        my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) );
89
        my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) );
90
        my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 )
90
        my $newimage      = GD::Image->new( $width_reduce, $height_reduce, 1 );    #'1' creates true color image...
91
          ;        #'1' creates true color image...
92
        $newimage->alphaBlending(0);
91
        $newimage->alphaBlending(0);
93
        $newimage->saveAlpha(1);
92
        $newimage->saveAlpha(1);
94
        $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height );
93
        $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height );
(-)a/tools/upload-cover-image.pl (-3 / +2 lines)
Lines 101-107 my @results; Link Here
101
if ( $op eq 'cud-process' && $fileID ) {
101
if ( $op eq 'cud-process' && $fileID ) {
102
    my $upload = Koha::UploadedFiles->find($fileID);
102
    my $upload = Koha::UploadedFiles->find($fileID);
103
    if ( $filetype eq 'image' ) {
103
    if ( $filetype eq 'image' ) {
104
        my $fh       = $upload->file_handle;
104
        my $fh = $upload->file_handle;
105
        GD::Image->trueColor(1);
105
        GD::Image->trueColor(1);
106
        my $srcimage = GD::Image->new($fh);
106
        my $srcimage = GD::Image->new($fh);
107
        $fh->close if $fh;
107
        $fh->close if $fh;
Lines 185-191 if ( $op eq 'cud-process' && $fileID ) { Link Here
185
                            my $full_filename =
185
                            my $full_filename =
186
                                Cwd::abs_path("$dir/$filename");    #Resolve any relative filepath references
186
                                Cwd::abs_path("$dir/$filename");    #Resolve any relative filepath references
187
                            my $srcimage;
187
                            my $srcimage;
188
                            if ( $full_filename =~ /^\Q$dir\E/ ){
188
                            if ( $full_filename =~ /^\Q$dir\E/ ) {
189
                                GD::Image->trueColor(1);
189
                                GD::Image->trueColor(1);
190
                                $srcimage = GD::Image->new($full_filename);
190
                                $srcimage = GD::Image->new($full_filename);
191
                            }
191
                            }
192
- 

Return to bug 8088