/usr/share/horde/ansel/lib/Tile/Image.php is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | <?php
/**
*
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Ansel
*/
/**
* Ansel_Tile_Image:: class wraps display of thumbnails displayed
* for a image on the Ansel_View_Gallery view.
*
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Ansel
*/
class Ansel_Tile_Image
{
/**
* Outputs the HTML for an image thumbnail tile.
*
* @param Ansel_Image $image The Ansel_Image we are displaying.
* @param Ansel_Style $style A sytle definiition array.
* @param boolean $mini Force the use of a mini thumbnail?
* @param array $params Any other paramaters needed by this tile
*
* @return Outputs the HTML for the image tile.
*/
static public function getTile(
Ansel_Image $image, Ansel_Style $style = null, $mini = false, array $params = array())
{
global $conf, $registry, $injector;
$page = isset($params['page']) ? $params['page'] : 0;
$view_type = isset($params['view']) ? $params['view'] : 'Gallery';
$view = $injector->createInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/tile');
$view->image = $image;
$view->view_type = $view_type;
try {
$view->parent = $injector
->getInstance('Ansel_Storage')
->getGallery($image->gallery);
} catch (Ansel_Exception $e) {
// @TODO: Short circuit here and return a generic error tile.
} catch (Horde_Exception_NotFound $e) {
// @TODO: Ditto above.
}
if (is_null($style)) {
$style = $view->parent->getStyle();
}
$date = $view->parent->getDate();
if ($view_type == 'Results') {
$haveSearch = 1;
} else {
$haveSearch = 0;
}
// Override the thumbnail to mini or use style default?
$thumbstyle = $mini ? 'mini' : 'thumb';
// URL for image properties/actions
$view->image_url = Horde::url('image.php')->add(
array_merge(
array('gallery' => $image->gallery,
'page' => $page,
'image' => $image->id,
'havesearch' => $haveSearch),
$date));
// URL to view the image. This is the link for the Tile.
// $view_url is the link for the thumbnail and since this might not
// always point to the image view page, we set $img_view_url to link to
// the image view
$view->img_view_url = Ansel::getUrlFor('view', array_merge(
array('gallery' => $image->gallery,
'slug' => $view->parent->get('slug'),
'page' => $page,
'view' => 'Image',
'image'=> $image->id,
'havesearch' => $haveSearch),
$date));
if (!empty($params['image_view_src'])) {
$view->view_url = Ansel::getImageUrl($image->id, 'screen', true);
} elseif (empty($params['image_view_url'])) {
$view->view_url = new Horde_Url($view->img_view_url);
} else {
$view->view_url = new Horde_Url(
str_replace(
array('%i', '%g', '%s'),
array($image->id, $image->gallery, $view->parent->get('slug')),
urldecode($params['image_view_url'])
)
);
// If we override the view_url, assume we want to override this also
$view->img_view_url = $view->view_url;
}
// Need the gallery URL to display the "From" link when showing
// the image tile from somewhere other than the gallery view.
if (!empty($view_type) || basename($_SERVER['PHP_SELF']) == 'view.php') {
$view->gallery_url = Ansel::getUrlFor(
'view',
array_merge(
array(
'gallery' => $view->parent->id,
'slug' => $view->parent->get('slug'),
'view' => 'Gallery',
'havesearch' => $haveSearch),
$date)
);
}
$view->thumb_url = Ansel::getImageUrl($image->id, $thumbstyle, true, $style);
$view->option_select = $view->parent->hasPermission($registry->getAuth(), Horde_Perms::DELETE);
$view->option_edit = $view->parent->hasPermission($registry->getAuth(), Horde_Perms::EDIT);
$view->imgAttributes = (!empty($params['image_view_attributes']) ? $params['image_view_attributes'] : array());
$view->option_comments = ($conf['comments']['allow'] == 'all' || ($conf['comments']['allow'] == 'authenticated' && $registry->getAuth())) && empty($params['hide_comments']);
$view->imgOnClick = (!empty($params['image_onclick'])
? str_replace('%i', $image->id, $params['image_onclick'])
: '');
$view->imageCaption = $injector
->getInstance('Horde_Core_Factory_TextFilter')
->filter(
$image->caption,
'text2html',
array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
if (!empty($params['image_view_title']) &&
!empty($image->_data[$params['image_view_title']])) {
$title = $image->_data[$params['image_view_title']];
} else {
$title = $image->filename;
}
// In-line caption editing if we have Horde_Perms::EDIT
if ($view->option_edit) {
try {
$geometry = $image->getDimensions($thumbstyle);
$injector->createInstance('Horde_Core_Factory_Imple')->create(
'Ansel_Ajax_Imple_EditCaption',
array(
'dataid' => $image->id,
'id' => $image->id . 'caption',
'width' => $geometry['width']));
} catch (Ansel_Exception $e) {
}
}
return $view->render('image');
}
}
|