diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index e37495e1f..359108fba 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,7 @@ - fixed #11780: fixFilenames regex needs an anchor in ZipArchive asset - fixed #11782: Attachments all showing duplicated first thumbnail - fixed #11777: Thingy search on yes no field fails + - fixed #11787: Gallery resolutions wrongly ordered 7.9.12 - webgui.org homepage gives 404 (#11778) diff --git a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm index 24fcbd820..c26e6abfe 100644 --- a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm +++ b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm @@ -306,7 +306,7 @@ sub getResolutions { my $storage = $self->getStorageLocation; # Return a list not including the web view image. - return [ sort { $a cmp $b } grep { $_ ne $self->get("filename") } @{ $storage->getFiles } ]; + return [ sort { $a <=> $b } grep { $_ ne $self->get("filename") } @{ $storage->getFiles } ]; } #---------------------------------------------------------------------------- diff --git a/t/Asset/File/GalleryFile/Photo/adjustOrientation.t b/t/Asset/File/GalleryFile/Photo/adjustOrientation.t index 53581528e..9545b0e6b 100644 --- a/t/Asset/File/GalleryFile/Photo/adjustOrientation.t +++ b/t/Asset/File/GalleryFile/Photo/adjustOrientation.t @@ -39,7 +39,7 @@ addToCleanup($versionTag); my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - imageResolutions => "1024x768", + imageResolutions => "1024", }, undef, undef, diff --git a/t/Asset/File/GalleryFile/Photo/makeResolutions.t b/t/Asset/File/GalleryFile/Photo/makeResolutions.t index 9305c9cb1..a8d1d6861 100644 --- a/t/Asset/File/GalleryFile/Photo/makeResolutions.t +++ b/t/Asset/File/GalleryFile/Photo/makeResolutions.t @@ -35,7 +35,7 @@ my ($gallery, $album, $photo); $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - imageResolutions => "1600x1200\n1024x768\n800x600\n640x480", + imageResolutions => "1600\n1024\n800\n640", }); $album = $gallery->addChild({ @@ -75,7 +75,7 @@ diag( $@ ) cmp_deeply( $photo->getStorageLocation->getFiles, - bag( '1024x768.jpg', '1600x1200.jpg', '640x480.jpg', '800x600.jpg', 'page_title.jpg' ), + bag( '1024.jpg', '1600.jpg', '640.jpg', '800.jpg', 'page_title.jpg' ), "makeResolutions makes all the required resolutions with the appropriate names.", ); @@ -91,7 +91,7 @@ WebGUI::Test->addToCleanup($versionTags[-1]); $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - imageResolutions => "1600x1200\n1024x768\n800x600\n640x480", + imageResolutions => "1600\n1024\n800\n640", }); $album = $gallery->addChild({ @@ -116,12 +116,12 @@ $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollater $photo->update({ filename => 'page_title.jpg' }); ok( - !eval{ $photo->makeResolutions('100x100','200x200'); 1 }, + !eval{ $photo->makeResolutions('100','200'); 1 }, "makeResolutions fails when first argument is not array reference", ); ok( - eval{ $photo->makeResolutions(['100x100','200x200']); 1 }, + eval{ $photo->makeResolutions(['100','200']); 1 }, "makeResolutions succeeds when first argument is array reference of resolutions to make", ); diag( $@ ) @@ -129,7 +129,7 @@ diag( $@ ) is_deeply( [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], - ['100x100.jpg', '200x200.jpg', 'page_title.jpg'], + ['100.jpg', '200.jpg', 'page_title.jpg'], "makeResolutions makes all the required resolutions with the appropriate names.", ); @@ -157,18 +157,18 @@ $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollater $photo->update({ filename => 'page_title.jpg' }); ok( - !eval{ $photo->makeResolutions('100x100','200x200'); 1 }, + !eval{ $photo->makeResolutions('100','200'); 1 }, "makeResolutions fails when first argument is not array reference", ); ok( - eval{ $photo->makeResolutions(['100x100','200x200']); 1 }, + eval{ $photo->makeResolutions(['100','200']); 1 }, "makeResolutions succeeds when first argument is array reference of resolutions to make", ); is_deeply( [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], - ['100x100.jpg', '200x200.jpg', 'page_title.jpg'], + ['100.jpg', '200.jpg', 'page_title.jpg'], "makeResolutions makes all the required resolutions with the appropriate names.", ); diff --git a/t/Asset/File/GalleryFile/Photo/rotate.t b/t/Asset/File/GalleryFile/Photo/rotate.t index b6a72f9c4..9b20ac9b9 100644 --- a/t/Asset/File/GalleryFile/Photo/rotate.t +++ b/t/Asset/File/GalleryFile/Photo/rotate.t @@ -37,7 +37,7 @@ addToCleanup($versionTag); my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - imageResolutions => "1024x768", + imageResolutions => "1024", }, undef, undef, diff --git a/t/Asset/File/GalleryFile/Photo/setFile.t b/t/Asset/File/GalleryFile/Photo/setFile.t index 3ea16a6c4..a45720b75 100644 --- a/t/Asset/File/GalleryFile/Photo/setFile.t +++ b/t/Asset/File/GalleryFile/Photo/setFile.t @@ -30,7 +30,7 @@ $versionTag->set({name=>"Photo Test"}); my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - imageResolutions => "1024x768", + imageResolutions => "1024", }); my $album = $gallery->addChild({ @@ -62,7 +62,7 @@ $photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); my $storage = $photo->getStorageLocation; cmp_deeply( - $storage->getFiles, bag('page_title.jpg','1024x768.jpg'), + $storage->getFiles, bag('page_title.jpg','1024.jpg'), "Storage location contains the resolution file", );