Overview

Packages

  • Ansel
  • None

Classes

  • Ansel
  • Ansel_Ajax_Application
  • Ansel_Ajax_Imple_EditCaption
  • Ansel_Ajax_Imple_EditFaces
  • Ansel_Ajax_Imple_EditGalleryFaces
  • Ansel_Ajax_Imple_Embed
  • Ansel_Ajax_Imple_GallerySlugCheck
  • Ansel_Ajax_Imple_ImageSaveGeotag
  • Ansel_Ajax_Imple_LocationAutoCompleter
  • Ansel_Ajax_Imple_MapLayerSelect
  • Ansel_Ajax_Imple_TagActions
  • Ansel_Ajax_Imple_ToggleGalleryActions
  • Ansel_Ajax_Imple_ToggleOtherGalleries
  • Ansel_Ajax_Imple_UploadNotification
  • Ansel_Api
  • Ansel_Exception
  • Ansel_Faces
  • Ansel_Faces_Base
  • Ansel_Faces_Facedetect
  • Ansel_Faces_User
  • Ansel_Factory_Faces
  • Ansel_Factory_Storage
  • Ansel_Factory_Styles
  • Ansel_Form_Ecard
  • Ansel_Form_Image
  • Ansel_Form_ImageDate
  • Ansel_Form_Upload
  • Ansel_Gallery
  • Ansel_Gallery_Decorator_Date
  • Ansel_GalleryMode_Base
  • Ansel_GalleryMode_Date
  • Ansel_GalleryMode_Normal
  • Ansel_Image
  • Ansel_ImageGenerator
  • Ansel_ImageGenerator_Mini
  • Ansel_ImageGenerator_PolaroidThumb
  • Ansel_ImageGenerator_PolaroidThumbStack
  • Ansel_ImageGenerator_RoundedThumb
  • Ansel_ImageGenerator_RoundedThumbStack
  • Ansel_ImageGenerator_Screen
  • Ansel_ImageGenerator_ShadowThumb
  • Ansel_ImageGenerator_ShadowThumbStack
  • Ansel_ImageGenerator_SquareThumb
  • Ansel_ImageGenerator_Thumb
  • Ansel_LoginTasks_SystemTask_Upgrade
  • Ansel_Report
  • Ansel_Report_letter
  • Ansel_Report_mail
  • Ansel_Report_tickets
  • Ansel_Search
  • Ansel_Search_exif
  • Ansel_Search_Tag
  • Ansel_Storage
  • Ansel_Style
  • Ansel_Tagger
  • Ansel_Test
  • Ansel_Tile_DateGallery
  • Ansel_Tile_Gallery
  • Ansel_Tile_Image
  • Ansel_View_Ansel
  • Ansel_View_Base
  • Ansel_View_EmbeddedRenderer_GalleryLink
  • Ansel_View_EmbeddedRenderer_Mini
  • Ansel_View_EmbeddedRenderer_Slideshow
  • Ansel_View_Gallery
  • Ansel_View_GalleryProperties
  • Ansel_View_GalleryRenderer_Base
  • Ansel_View_GalleryRenderer_Gallery
  • Ansel_View_GalleryRenderer_GalleryLightbox
  • Ansel_View_Image
  • Ansel_View_List
  • Ansel_View_Results
  • Ansel_View_Slideshow
  • Ansel_View_Upload
  • Ansel_Widget
  • Ansel_Widget_Actions
  • Ansel_Widget_Base
  • Ansel_Widget_GalleryFaces
  • Ansel_Widget_Geotag
  • Ansel_Widget_ImageFaces
  • Ansel_Widget_Links
  • Ansel_Widget_OtherGalleries
  • Ansel_Widget_OwnerFaces
  • Ansel_Widget_SimilarPhotos
  • Ansel_Widget_Tags
  • Ansel_XPPublisher
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Ansel_Tile_Image:: class wraps display of thumbnails displayed
  4:  * for a image on the Ansel_View_Gallery view.
  5:  *
  6:  * @author Michael Rubinsky <mrubinsk@horde.org>
  7:  * @category Horde
  8:  * @license  http://www.horde.org/licenses/gpl GPL
  9:  * @package  Ansel
 10:  */
 11: class Ansel_Tile_Image
 12: {
 13:     /**
 14:      * Outputs the HTML for an image thumbnail 'tile'.
 15:      *
 16:      * @param Ansel_Image $image     The Ansel_Image we are displaying.
 17:      * @param Ansel_Gallery $parent  The parent Ansel_Gallery for this image.
 18:      *                               If null, will create a new instance of
 19:      *                               the Ansel_Gallery
 20:      * @param Ansel_Style $style     A sytle definiition array.
 21:      * @param boolean $mini          Force the use of a mini thumbnail?
 22:      * @param string $params         Any other paramaters needed by this tile
 23:      *
 24:      * @return  Outputs the HTML for the image tile.
 25:      */
 26:     public function getTile($image, $style = null, $mini = false, $params = array())
 27:     {
 28:         global $conf, $registry;
 29: 
 30:         $parent = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($image->gallery);
 31:         if (is_null($style)) {
 32:             $style = $parent->getStyle();
 33:         }
 34: 
 35:         $page = isset($params['page']) ? $params['page'] : 0;
 36:         $view = isset($params['view']) ? $params['view'] : 'Gallery';
 37:         $date = $parent->getDate();
 38: 
 39:         if ($view == 'Results') {
 40:             $haveSearch = 1;
 41:         } else {
 42:             $haveSearch = 0;
 43:         }
 44: 
 45:         /* Override the thumbnail to mini or use style default? */
 46:         $thumbstyle = $mini ? 'mini' : 'thumb';
 47: 
 48:         /* URL for image properties/actions etc... */
 49:         $image_url = Horde::url('image.php')->add(
 50:              array_merge(
 51:                array('gallery' => $image->gallery,
 52:                      'page' => $page,
 53:                      'image' => $image->id,
 54:                      'havesearch' => $haveSearch),
 55:                $date));
 56: 
 57:         /* URL to view the image. This is the link for the Tile.
 58:          * $view_url is the link for the thumbnail and since this might not
 59:          * always point to the image view page, we set $img_view_url to link to
 60:          * the image view
 61:          */
 62:         $img_view_url = Ansel::getUrlFor('view', array_merge(
 63:             array('gallery' => $image->gallery,
 64:                   'slug' => $parent->get('slug'),
 65:                   'page' => $page,
 66:                   'view' => 'Image',
 67:                   'image'=> $image->id,
 68:                   'havesearch' => $haveSearch),
 69:             $date));
 70: 
 71:         if (!empty($params['image_view_src'])) {
 72:             $view_url = Ansel::getImageUrl($image->id, 'screen', true);
 73:         } elseif (empty($params['image_view_url'])) {
 74:             $view_url = new Horde_Url($img_view_url);
 75:         } else {
 76:             $view_url = new Horde_Url(
 77:                 str_replace(array('%i', '%g', '%s'),
 78:                             array($image->id, $image->gallery, $parent->get('slug')),
 79:                             urldecode($params['image_view_url'])));
 80: 
 81:             // If we override the view_url, assume we want to override this also
 82:             $img_view_url = $view_url;
 83:         }
 84: 
 85:         // Need the gallery URL to display the "From" link when showing
 86:         // the image tile from somewhere other than the gallery view.
 87:         if (!empty($view) || basename($_SERVER['PHP_SELF']) == 'view.php') {
 88:             $gallery_url = Ansel::getUrlFor('view', array_merge(
 89:                 array('gallery' => $parent->id,
 90:                       'slug' => $parent->get('slug'),
 91:                       'view' => 'Gallery',
 92:                       'havesearch' => $haveSearch),
 93:                 $date));
 94:         }
 95: 
 96:         $thumb_url = Ansel::getImageUrl($image->id, $thumbstyle, true, $style);
 97: 
 98:         $option_select = $parent->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE);
 99:         $option_edit = $parent->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
100:         $imgAttributes = (!empty($params['image_view_attributes']) ? $params['image_view_attributes'] : array());
101: 
102:         $imgOnClick = (!empty($params['image_onclick'])
103:                 ? str_replace('%i', $image->id, $params['image_onclick'])
104:                 : '');
105: 
106:         $imageCaption = $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter(
107:             $image->caption, 'text2html',
108:             array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
109: 
110:         if (!empty($params['image_view_title']) &&
111:             !empty($image->_data[$params['image_view_title']])) {
112:             $title = $image->_data[$params['image_view_title']];
113:         } else {
114:             $title = $image->filename;
115:         }
116: 
117:         Horde::startBuffer();
118:         // In-line caption editing if we have Horde_Perms::EDIT
119:         if ($option_edit) {
120:             // @TODO: passing thumbstyle here doesn't look right to me.
121:             try {
122:                 $geometry = $image->getDimensions($thumbstyle);
123:                 $GLOBALS['injector']->createInstance('Horde_Core_Factory_Imple')->create(
124:                     array('ansel', 'EditCaption'),
125:                     array('domid' => $image->id . 'caption',
126:                           'id' => $image->id,
127:                           'width' => $geometry['width']));
128:             } catch (Ansel_Exception $e) {
129:             }
130:         }
131:         include ANSEL_BASE . '/templates/tile/image.inc';
132: 
133:         return Horde::endBuffer();
134:     }
135: }
136: 
API documentation generated by ApiGen