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

(-)a/Koha/CoverImage.pm (-5 / +7 lines)
Lines 74-79 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);
78
	$image->saveAlpha(1);
77
    if ( $width > $maxwidth || $height > $maxheight ) {
79
    if ( $width > $maxwidth || $height > $maxheight ) {
78
80
79
        my $percent_reduce;    # Percent we will reduce the image dimensions by...
81
        my $percent_reduce;    # Percent we will reduce the image dimensions by...
Lines 85-95 sub _scale_image { Link Here
85
        }
87
        }
86
        my $width_reduce  = sprintf( "%.0f", ( $width * $percent_reduce ) );
88
        my $width_reduce  = sprintf( "%.0f", ( $width * $percent_reduce ) );
87
        my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) );
89
        my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) );
88
        my $newimage      = GD::Image->new( $width_reduce, $height_reduce, 1 );    #'1' creates true color image...
90
        my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 )
89
        $newimage->copyResampled(
91
          ;        #'1' creates true color image...
90
            $image, 0, 0, 0, 0, $width_reduce,
92
        $newimage->alphaBlending(0);
91
            $height_reduce, $width, $height
93
        $newimage->saveAlpha(1);
92
        );
94
        $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height );
93
        return $newimage;
95
        return $newimage;
94
    } else {
96
    } else {
95
        return $image;
97
        return $image;
(-)a/tools/upload-cover-image.pl (-2 / +3 lines)
Lines 102-107 if ( $op eq 'cud-process' && $fileID ) { Link Here
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
        my $srcimage = GD::Image->new($fh);
106
        my $srcimage = GD::Image->new($fh);
106
        $fh->close if $fh;
107
        $fh->close if $fh;
107
        if ( defined $srcimage ) {
108
        if ( defined $srcimage ) {
Lines 184-190 if ( $op eq 'cud-process' && $fileID ) { Link Here
184
                            my $full_filename =
185
                            my $full_filename =
185
                                Cwd::abs_path("$dir/$filename");    #Resolve any relative filepath references
186
                                Cwd::abs_path("$dir/$filename");    #Resolve any relative filepath references
186
                            my $srcimage;
187
                            my $srcimage;
187
                            if ( $full_filename =~ /^\Q$dir\E/ ) {
188
                            if ( $full_filename =~ /^\Q$dir\E/ ){
189
                                GD::Image->trueColor(1);
188
                                $srcimage = GD::Image->new($full_filename);
190
                                $srcimage = GD::Image->new($full_filename);
189
                            }
191
                            }
190
                            my $biblio;
192
                            my $biblio;
191
- 

Return to bug 8088