diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 09ef5ab12..23d3d6581 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -24,6 +24,7 @@ - fixed #9380: CoolMenus template - invalid markup affecting page layouts - fixed #9387: Asset Manager breaks navigating into a Gallery Album - fixed #9001: Thingy add image broken + - fixed #9386: Gallery: "Image resolutions" issue 7.6.7 - fixed #9263: Thingy possibleValues processing, and List type autodetection. diff --git a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm index fdb9db05b..0c58c2be7 100644 --- a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm +++ b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm @@ -22,6 +22,7 @@ use Image::ExifTool qw( :Public ); use JSON qw/ encode_json decode_json /; use URI::Escape; use Tie::IxHash; +use List::MoreUtils; use WebGUI::DateTime; use WebGUI::Friends; @@ -360,14 +361,19 @@ sub makeResolutions { my $storage = $self->getStorageLocation; $self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'}); - for my $res ( @$resolutions ) { + my $filename = $self->get('filename'); + RESOLUTION: for my $res ( @$resolutions ) { # carp if resolution is bad if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) { carp "Geometry '$res' is invalid. Skipping."; - next; + next RESOLUTION; } + ##Only resize images if the image is too big! + my ($imageX, $imageY) = $storage->getSizeInPixels($filename); + my @resolutions = split /x/, $res; + next RESOLUTION if List::MoreUtils::any { $imageX < $_ && $imageY < $_ } @resolutions; my $newFilename = $res . ".jpg"; - $storage->copyFile( $self->get("filename"), $newFilename ); + $storage->copyFile( $filename, $newFilename ); $storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) ); } }