From 37cc627e201c10ba0eb897c47060b525e3192667 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 19 Dec 2023 22:42:30 +0100 Subject: [PATCH] PhotosIndex: add dualMixed layout This combines one landscape with one portrait. --- models/PhotoMosaic.php | 1 + templates/PhotosIndex.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/models/PhotoMosaic.php b/models/PhotoMosaic.php index 7f6717c9..71981f0c 100644 --- a/models/PhotoMosaic.php +++ b/models/PhotoMosaic.php @@ -52,6 +52,7 @@ class PhotoMosaic // Dual layouts 'dualLandscapes' => [Image::TYPE_LANDSCAPE, Image::TYPE_LANDSCAPE], 'dualPortraits' => [Image::TYPE_PORTRAIT, Image::TYPE_PORTRAIT], + 'dualMixed' => [Image::TYPE_LANDSCAPE, Image::TYPE_PORTRAIT], // Fallback layouts 'singleLandscape' => [Image::TYPE_LANDSCAPE], diff --git a/templates/PhotosIndex.php b/templates/PhotosIndex.php index c9fe7159..a1915e03 100644 --- a/templates/PhotosIndex.php +++ b/templates/PhotosIndex.php @@ -270,6 +270,29 @@ class PhotosIndex extends Template '; } + protected function dualMixed(array $photos, $altLayout) + { + $image = array_shift($photos); + + echo ' +
+
'; + + $this->photo($image, 'landscape', static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top'); + + echo ' +
+
'; + + $this->photo($image, 'portrait', static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true); + + echo ' +
+
+ '; + } + protected function dualPortraits(array $photos, $altLayout) { // Recycle the row layout so portraits don't appear too large