Rewrite mosaic algorithm using declarative paradigm #42
@ -32,6 +32,10 @@ class PhotoMosaic
|
||||
// Single 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
|
||||
'sidePortrait' => [Image::TYPE_PORTRAIT, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE,
|
||||
Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
|
||||
|
@ -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)
|
||||
{
|
||||
$image = array_shift($photos);
|
||||
|
Loading…
Reference in New Issue
Block a user