forked from Public/pics
Add single photo pages, navigateable by arrow keys and touch gestures.
This commit is contained in:
32
controllers/ViewPhoto.php
Normal file
32
controllers/ViewPhoto.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
* ViewPhoto.php
|
||||
* Contains the view photo controller
|
||||
*
|
||||
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
|
||||
*****************************************************************************/
|
||||
|
||||
class ViewPhoto extends HTMLController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$photo = Asset::fromSlug($_GET['slug']);
|
||||
if (empty($photo))
|
||||
throw new NotFoundException();
|
||||
|
||||
parent::__construct($photo->getTitle() . ' - ' . SITE_TITLE);
|
||||
$page = new PhotoPage($photo->getImage());
|
||||
|
||||
// Exif data?
|
||||
$exif = EXIF::fromFile($photo->getFullPath());
|
||||
if ($exif)
|
||||
$page->setExif($exif);
|
||||
|
||||
$this->page->adopt($page);
|
||||
$this->page->setCanonicalUrl($photo->getPageUrl());
|
||||
|
||||
// Add an edit button to the admin bar.
|
||||
if (Registry::get('user')->isAdmin())
|
||||
$this->admin_bar->appendItem(BASEURL . '/editasset/?id=' . $photo->getId(), 'Edit this photo');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user