PhotoMosaic: introduce availableLayouts method
This commit is contained in:
parent
b98785d7b2
commit
8700fc1417
@ -10,11 +10,13 @@ class PhotoMosaic
|
||||
{
|
||||
const NUM_DAYS_CUTOFF = 7;
|
||||
private AssetIterator $iterator;
|
||||
private $layouts;
|
||||
private $queue = [];
|
||||
|
||||
public function __construct(AssetIterator $iterator)
|
||||
{
|
||||
$this->iterator = $iterator;
|
||||
$this->layouts = $this->availableLayouts();
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
@ -22,6 +24,28 @@ class PhotoMosaic
|
||||
$this->iterator->clean();
|
||||
}
|
||||
|
||||
private function availableLayouts()
|
||||
{
|
||||
static $layouts = [
|
||||
// Single panorama
|
||||
'panorama' => [Image::TYPE_PANORAMA],
|
||||
|
||||
// Big-small juxtapositions
|
||||
'portrait' => [Image::TYPE_PORTRAIT, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
|
||||
'landscape' => [Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
|
||||
|
||||
// Single row of three
|
||||
'landscapes' => [Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
|
||||
'portraits' => [Image::TYPE_PORTRAIT, Image::TYPE_PORTRAIT, Image::TYPE_PORTRAIT],
|
||||
|
||||
// Fallback layouts
|
||||
'duo' => [Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE],
|
||||
'single' => [Image::TYPE_LANDSCAPE | Image::TYPE_PORTRAIT],
|
||||
];
|
||||
|
||||
return $layouts;
|
||||
}
|
||||
|
||||
private static function daysApart(Image $a, Image $b)
|
||||
{
|
||||
return $a->getDateCaptured()->diff($b->getDateCaptured())->days;
|
||||
|
Loading…
Reference in New Issue
Block a user