Only resize photos if they are larger than the Gallery resolutions.
This commit is contained in:
parent
b54308626b
commit
a894bf906a
2 changed files with 10 additions and 3 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
- fixed #9380: CoolMenus template - invalid markup affecting page layouts
|
- fixed #9380: CoolMenus template - invalid markup affecting page layouts
|
||||||
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
|
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
|
||||||
- fixed #9001: Thingy add image broken
|
- fixed #9001: Thingy add image broken
|
||||||
|
- fixed #9386: Gallery: "Image resolutions" issue
|
||||||
|
|
||||||
7.6.7
|
7.6.7
|
||||||
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
|
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ use Image::ExifTool qw( :Public );
|
||||||
use JSON qw/ encode_json decode_json /;
|
use JSON qw/ encode_json decode_json /;
|
||||||
use URI::Escape;
|
use URI::Escape;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
|
use List::MoreUtils;
|
||||||
|
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use WebGUI::Friends;
|
use WebGUI::Friends;
|
||||||
|
|
@ -360,14 +361,19 @@ sub makeResolutions {
|
||||||
my $storage = $self->getStorageLocation;
|
my $storage = $self->getStorageLocation;
|
||||||
$self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'});
|
$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
|
# carp if resolution is bad
|
||||||
if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) {
|
if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) {
|
||||||
carp "Geometry '$res' is invalid. Skipping.";
|
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";
|
my $newFilename = $res . ".jpg";
|
||||||
$storage->copyFile( $self->get("filename"), $newFilename );
|
$storage->copyFile( $filename, $newFilename );
|
||||||
$storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) );
|
$storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue