From 7240201a3ef1fb03e0a80313a407cd9b71419e7f Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 2 Sep 2016 20:23:47 +0200 Subject: [PATCH] PhotoMosaic: allow sets of three portraits. --- models/PhotoMosaic.php | 4 ++++ templates/PhotosIndex.php | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/models/PhotoMosaic.php b/models/PhotoMosaic.php index 2365836..5d61c1d 100644 --- a/models/PhotoMosaic.php +++ b/models/PhotoMosaic.php @@ -115,6 +115,10 @@ class PhotoMosaic // Sort photos by priority and date captured. usort($photos, 'self::orderPhotos'); + // Three portraits? + if ($num_portrait === 3) + return [$photos, 'portraits']; + // At least one portrait? if ($num_portrait >= 1) { diff --git a/templates/PhotosIndex.php b/templates/PhotosIndex.php index da7b8c4..47daf87 100644 --- a/templates/PhotosIndex.php +++ b/templates/PhotosIndex.php @@ -241,4 +241,24 @@ class PhotosIndex extends SubTemplate echo ' '; } + + protected function portraits(array $photos) + { + echo ' +
'; + + foreach ($photos as $image) + { + echo ' +
'; + + $this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true); + + echo ' +
'; + } + + echo ' +
'; + } }