mosaic = $mosaic;
$this->show_edit_buttons = $show_edit_buttons;
$this->show_headers = $show_headers;
$this->show_labels = $show_labels;
}
protected function html_content()
{
echo '
';
for ($i = $this->row_limit; $i > 0 && $row = $this->mosaic->getRow(); $i--)
{
list($photos, $what) = $row;
$this->header($photos);
$this->$what($photos);
}
echo '
';
}
protected function header($photos)
{
if (!$this->show_headers)
return;
$date = $photos[0]->getDateCaptured();
if (!$date)
return;
$header = $date->format('F Y');
if ($header === $this->previous_header)
return;
$name = str_replace(' ', '', strtolower($header));
echo '
';
$this->previous_header = $header;
}
protected function color(Image $image)
{
$color = $image->bestColor();
if ($color == 'FFFFFF')
$color = 'ccc';
return $color;
}
protected function photo(Image $image, $width, $height, $crop = true, $fit = true)
{
if ($this->show_edit_buttons)
echo '
Edit';
echo '
';
if ($this->show_labels)
echo '
', $image->getTitle(), '
';
echo '
';
}
protected function panorama(array $photos)
{
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::PANORAMA_WIDTH, static::PANORAMA_HEIGHT, false, false);
echo '
';
}
}
protected function portrait(array $photos)
{
$image = array_shift($photos);
echo '
';
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, 'centre');
echo '
';
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'centre');
echo '
';
}
echo '
';
}
protected function landscape(array $photos)
{
$image = array_shift($photos);
echo '
';
$this->photo($image, static::LANDSCAPE_WIDTH, static::LANDSCAPE_HEIGHT, 'top');
echo '
';
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, 'top');
echo '
';
}
echo '
';
}
protected function duo(array $photos)
{
echo '
';
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::DUO_WIDTH, static::DUO_HEIGHT, true);
echo '
';
}
echo '
';
}
protected function single(array $photos)
{
$image = array_shift($photos);
echo '
';
$this->photo($image, static::SINGLE_WIDTH, static::SINGLE_HEIGHT, 'top');
echo '
';
}
protected function row(array $photos)
{
echo '
';
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::TILE_WIDTH, static::TILE_HEIGHT, true);
echo '
';
}
echo '
';
}
protected function portraits(array $photos)
{
echo '
';
foreach ($photos as $image)
{
echo '
';
$this->photo($image, static::PORTRAIT_WIDTH, static::PORTRAIT_HEIGHT, true);
echo '
';
}
echo '
';
}
public function setUrlSuffix($suffix)
{
$this->url_suffix = $suffix;
}
}