Rewrite mosaic algorithm using declarative paradigm #42

Merged
Roflin merged 8 commits from new-mosaic into master 2023-12-03 12:37:41 +01:00
2 changed files with 11 additions and 0 deletions
Showing only changes of commit efb35cfd6a - Show all commits

View File

@ -32,6 +32,10 @@ class PhotoMosaic
// Single panorama // Single panorama
'panorama' => [Image::TYPE_PANORAMA], 'panorama' => [Image::TYPE_PANORAMA],
// A whopping six landscapes?
'sixLandscapes' => [Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE,
Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
// Big-small juxtapositions // Big-small juxtapositions
'sidePortrait' => [Image::TYPE_PORTRAIT, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE, 'sidePortrait' => [Image::TYPE_PORTRAIT, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE,
Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE], Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],

View File

@ -137,6 +137,13 @@ class PhotosIndex extends Template
} }
} }
protected function sixLandscapes(array $photos, $altLayout)
{
$chunks = array_chunk($photos, 3);
$this->sideLandscape($chunks[0], $altLayout);
$this->threeLandscapes($chunks[1], $altLayout);
}
protected function sidePortrait(array $photos, $altLayout) protected function sidePortrait(array $photos, $altLayout)
{ {
$image = array_shift($photos); $image = array_shift($photos);