PhotoMosaic: allow sets of three portraits.

This commit is contained in:
Aaron van Geffen 2016-09-02 20:23:47 +02:00
parent df7655e00b
commit 7240201a3e
2 changed files with 24 additions and 0 deletions

View File

@ -115,6 +115,10 @@ class PhotoMosaic
// Sort photos by priority and date captured. // Sort photos by priority and date captured.
usort($photos, 'self::orderPhotos'); usort($photos, 'self::orderPhotos');
// Three portraits?
if ($num_portrait === 3)
return [$photos, 'portraits'];
// At least one portrait? // At least one portrait?
if ($num_portrait >= 1) if ($num_portrait >= 1)
{ {

View File

@ -241,4 +241,24 @@ class PhotosIndex extends SubTemplate
echo ' echo '
</div>'; </div>';
} }
protected function portraits(array $photos)
{
echo '
<div class="tiled_row">';
foreach ($photos as $image)
{
echo '
<div style="border-color: #', $this->color($image), '" class="portrait">';
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
echo '
</div>';
}
echo '
</div>';
}
} }