private function _viewImage(GalleryImageModel $image)
 {
     $album = $image->getLink('GalleryAlbum');
     $view = $this->getView();
     $manager = \Core\user()->checkAccess('p:/gallery/manage_all');
     $editor = \Core\user()->checkAccess($album->get('editpermissions')) || $manager;
     $uploader = \Core\user()->checkAccess($album->get('uploadpermissions')) || $editor;
     // Uploaders only can only edit their own image!
     if (!$editor && $image->get('uploaderid') != \Core\user()->get('id')) {
         $uploader = false;
     }
     // I still need all the other images to know where this image lies in the stack!
     $images = $album->getLink('GalleryImage', 'weight');
     if (!$image->exists()) {
         return View::ERROR_NOTFOUND;
     }
     if ($image->get('albumid') != $album->get('id')) {
         return View::ERROR_NOTFOUND;
     }
     $id = $image->get('id');
     $link = $image->getRewriteURL();
     $exif = $image->getExif();
     $metas = new \Core\Filestore\FileMetaHelper($image->getOriginalFile());
     //var_dump($exif); die();
     /*
     
     foreach($exif as $k => $v){
     	echo $k . ': {$exif.' . $k . '}&lt;br/>' . '//' . $v . "<br/>\n";
     }
     var_dump($exif); die();
     */
     $next = null;
     $prev = null;
     $lastnum = sizeof($images) - 1;
     // Determine the next/prev array.
     foreach ($images as $k => $img) {
         if ($img->get('id') == $id) {
             // Found it! is it first or last?
             if ($k == 0 && $k == $lastnum) {
                 // both are blank.... well how 'bout that :/
             } elseif ($k == 0) {
                 // It's the first image.
                 $next = $images[$k + 1];
             } elseif ($k == $lastnum) {
                 // It's the last image.
                 $prev = $images[$k - 1];
             } else {
                 // It's somewhere in between :)
                 $next = $images[$k + 1];
                 $prev = $images[$k - 1];
             }
         }
     }
     $view->mode = View::MODE_PAGEORAJAX;
     $view->templatename = '/pages/gallery/view-' . $image->getFileType() . '.tpl';
     $view->assign('image', $image);
     $view->assign('album', $album);
     $view->assign('lightbox_available', Core::IsComponentAvailable('jquery-lightbox'));
     $view->assign('editor', $editor);
     $view->assign('manager', $manager);
     $view->assign('uploader', $uploader);
     $view->assign('prev', $prev);
     $view->assign('next', $next);
     $view->assign('exif', $exif);
     $view->assign('metas', $metas);
     $view->updated = $image->get('updated');
     $view->canonicalurl = \Core\resolve_link($link);
     if (is_array($metas->getMetaTitle('keywords'))) {
         $view->meta['keywords'] = implode(', ', $metas->getMetaTitle('keywords'));
     }
     $view->meta['description'] = $metas->getMetaTitle('description');
     $view->meta['og:image'] = $image->getFile()->getPreviewURL('200x200');
     //$view->addBreadcrumb($album->get('title'), $album->get('baseurl'));
     $view->title = $image->get('title') ? $image->get('title') : 'Image Details';
     // This is needed to prevent the parent from overriding the seotitle.
     $view->meta['title'] = $view->title;
     if ($editor) {
         $view->addControl(array('title' => 'Edit Image', 'link' => 'gallery/images/update/' . $album->get('id') . '?image=' . $image->get('id'), 'class' => 'ajax-link', 'icon' => 'edit', 'image' => $image->get('id')));
         $view->addControl(array('title' => 'Rotate CCW', 'link' => '#', 'class' => 'rotate-link', 'icon' => 'undo', 'image' => $image->get('id'), 'rotate' => 'ccw'));
         $view->addControl(array('title' => 'Rotate CW', 'link' => '#', 'class' => 'rotate-link', 'icon' => 'repeat', 'image' => $image->get('id'), 'rotate' => 'cw'));
         $view->addControl(array('title' => 'Remove Image', 'link' => 'gallery/images/delete/' . $album->get('id') . '?image=' . $image->get('id'), 'confirm' => 'Confirm deleting image?', 'icon' => 'remove'));
     }
 }