本文整理汇总了PHP中Ansel类的典型用法代码示例。如果您正苦于以下问题:PHP Ansel类的具体用法?PHP Ansel怎么用?PHP Ansel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ansel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _getOtherGalleries
/**
* Build the HTML for the other galleries widget content.
*
* @param Horde_View $view The view object.
*/
protected function _getOtherGalleries(&$view)
{
$owner = $this->_view->gallery->get('owner');
// Set up the tree
$tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('otherAnselGalleries_' . md5($owner), 'Javascript', array('class' => 'anselWidgets'));
try {
$galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('attributes' => $owner));
} catch (Ansel_Exception $e) {
Horde::log($e, 'ERR');
return;
}
foreach ($galleries as $gallery) {
$parents = $gallery->get('parents');
if (empty($parents)) {
$parent = null;
} else {
$parents = explode(':', $parents);
$parent = array_pop($parents);
}
$img = (string) Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'mini', true);
$link = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery'), true);
$tree->addNode(array('id' => $gallery->id, 'parent' => $parent, 'label' => $gallery->get('name'), 'expanded' => $gallery->id == $this->_view->gallery->id, 'params' => array('icon' => $img, 'url' => $link)));
}
Horde::startBuffer();
$tree->sort('label');
$tree->renderTree();
$view->tree = Horde::endBuffer();
$GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('Ansel_Ajax_Imple_ToggleOtherGalleries', array('id' => 'othergalleries-toggle'));
}
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:OtherGalleries.php
示例2: _content
/**
*/
protected function _content()
{
$GLOBALS['page_output']->addScriptFile('block.js');
/* Get the top level galleries */
try {
$galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('perm' => Horde_Perms::EDIT, 'attributes' => $GLOBALS['registry']->getAuth(), 'all_levels' => false, 'count' => empty($this->_params['limit']) ? 0 : $this->_params['limit'], 'sort_by' => 'last_modified', 'direction' => Ansel::SORT_DESCENDING));
} catch (Ansel_Exception $e) {
return $e->getMessage();
}
$header = array(_("Gallery Name"), _("Last Modified"), _("Photo Count"));
$html = <<<HEADER
<table class="linedRow" cellspacing="0" style="width:100%">
<thead><tr class="item nowrap">
<th class="item leftAlign">{$header['0']}</th>
<th class="item leftAlign">{$header['1']}</th>
<th class="item leftAlign">{$header['2']}</th>
</tr></thead>
<tbody>
HEADER;
foreach ($galleries as $gallery) {
$url = Ansel::getUrlFor('view', array('view' => 'Gallery', 'slug' => $gallery->get('slug'), 'gallery' => $gallery->id), true);
$html .= '<tr><td>' . $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");', 'onmouseover' => 'Ansel.previewImage(event, ' . $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) . ');')) . htmlspecialchars($gallery->get('name')) . '</a></td><td>' . strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified')) . '</td><td>' . (int) $gallery->countImages(true) . '</td></tr>';
}
$html .= '</tbody></table>';
return $html;
}
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:MyGalleries.php
示例3: _getGalleryActions
/**
* Helper function for generating the gallery actions selection widget.
*
* @param Horde_View $view The view object.
*/
protected function _getGalleryActions(&$view)
{
global $registry, $conf;
$id = $this->_view->gallery->id;
$galleryurl = Horde::url('gallery.php')->add('gallery', $id);
$selfurl = Horde::selfUrl(true, false, true);
$view->count = $count = $this->_view->gallery->countImages();
$date = $this->_view->gallery->getDate();
// Buid the url parameters to the zip link
$view_params = array('gallery' => $this->_view->gallery->id, 'view' => 'Gallery', 'slug' => $this->_view->gallery->get('slug'), 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0);
// Append the date information to the parameters if we need it
$view_params = array_merge($view_params, $date);
// Bookmark link
if ($registry->hasMethod('bookmarks/getAddUrl')) {
$api_params = array('url' => Ansel::getUrlFor('view', $view_params, true), 'title' => $this->_view->gallery->get('name'));
try {
$view->bookmark_url = new Horde_Url($registry->bookmarks->getAddUrl($api_params));
} catch (Horde_Exception $e) {
}
}
// Download as ZIP link
if (!empty($conf['gallery']['downloadzip']) && $this->_view->gallery->canDownload() && $count && $this->_view->gallery->hasFeature('zipdownload')) {
$zip_params = array_merge(array('actionID' => 'downloadzip'), $date);
$view->zip_url = $galleryurl->copy()->add($zip_params)->link(array('class' => 'widget'));
}
// Image upload, subgalleries, captions etc..
if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$view->hasEdit = true;
$view->properties_url = $galleryurl->copy()->add(array('actionID' => 'modify', 'url' => $selfurl))->link(array('class' => 'widget'));
if ($count) {
if ($this->_view->gallery->hasFeature('image_captions')) {
$params = array_merge(array('gallery' => $id), $date);
$view->captions_url = Horde::url('gallery/captions.php')->add($params)->link(array('class' => 'widget'));
}
if ($this->_view->gallery->hasFeature('sort_images')) {
$view->sort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id), $date))->link(array('class' => 'widget'));
$view->resetsort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id, 'action' => 'Reset'), $date))->link(array('class' => 'widget'));
}
$view->regenerate_url = $galleryurl->copy()->add(array('actionID' => 'generateThumbs'))->link(array('class' => 'widget'));
$view->regenerate_all = $galleryurl->copy()->add(array('actionID' => 'deleteCache'))->link(array('class' => 'widget'));
if ($conf['faces']['driver'] && $conf['faces']['driver'] !== 'user' && $this->_view->gallery->hasFeature('faces')) {
$view->faces_url = Horde::url('faces/gallery.php')->add(array_merge($date, array('gallery' => $id, 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0)))->link(array('class' => 'widget'));
}
}
if ($this->_view->gallery->hasFeature('stacks')) {
$view->gendefault_url = $galleryurl->copy()->add(array('actionID' => 'generateDefault', 'url' => $selfurl))->link(array('class' => 'widget'));
}
}
if ($registry->getAuth() && $this->_view->gallery->get('owner') == $registry->getAuth()) {
$url = new Horde_Url('#');
$view->perms_link = $url->link(array('class' => 'popup widget', 'onclick' => Horde::popupJs(Horde::url('perms.php'), array('params' => array('cid' => $this->_view->gallery->id), 'urlencode' => true)) . 'return false;'));
} elseif (!empty($conf['report_content']['driver']) && ($conf['report_content']['allow'] == 'authenticated' && $registry->isAuthenticated() || $conf['report_content']['allow'] == 'all')) {
$view->report_url = Horde::url('report.php')->add('gallery', $id)->link(array('class' => 'widget'));
}
if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
$view->have_delete = true;
$view->deleteall_url = $galleryurl->copy()->add('actionID', 'empty')->link(array('class' => 'widget'));
$view->deletegallery_url = $galleryurl->copy()->add('actionID', 'delete')->link(array('class' => 'widget'));
}
}
开发者ID:horde,项目名称:horde,代码行数:65,代码来源:Actions.php
示例4: html
public function html()
{
global $registry;
$view = $GLOBALS['injector']->createInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
$view->owner = $this->_view->gallery->get('owner');
$view->userfeedurl = Ansel::getUrlFor('rss_user', array('owner' => $view->owner));
$view->slug = $this->_view->gallery->get('slug');
$view->galleryname = $this->_view->gallery->get('name');
$view->galleryfeedurl = Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $view->slug));
$view->title = _("Links");
/* Embed html */
if (empty($this->_view->_params['image_id'])) {
/* Gallery view */
$params = array('count' => 10);
if (!empty($slug)) {
$params['gallery_slug'] = $slug;
} else {
$params['gallery_id'] = $this->_view->gallery->id;
}
} else {
// This is an image view
$params = array('thumbsize' => 'screen', 'images' => $this->_view->_params['image_id'], 'count' => 10);
}
$view->embed = Ansel::embedCode($params);
return $view->render('links');
}
开发者ID:jubinpatel,项目名称:horde,代码行数:27,代码来源:Links.php
示例5: _create
/**
*
* @return Horde_Image
*/
protected function _create()
{
$this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']), min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']), true);
/* Don't bother with these effects for a stack image
* (which will have a negative gallery_id). */
if ($this->_image->gallery > 0) {
if (is_null($this->_style)) {
$gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->_image->gallery);
$styleDef = $gal->getStyle();
} else {
$styleDef = $this->_style;
}
try {
/* Apply the effects - continue on error, but be sure to log */
$this->_image->addEffect('RoundCorners', array('border' => 2, 'bordercolor' => '#333'));
$this->_image->addEffect('DropShadow', array('background' => $styleDef->background, 'padding' => 5, 'distance' => 5, 'fade' => 3));
if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
$this->_image->addEffect('Unsharpmask', array('radius' => $GLOBALS['conf']['thumbnail']['radius'], 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'], 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
}
$this->_image->applyEffects();
} catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
return $this->_image->getHordeImage();
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:30,代码来源:RoundedThumb.php
示例6: _create
/**
*
* @return Horde_Image
*/
protected function _create()
{
// Take the largest requested dimension
if (empty($this->_params['width'])) {
$size = min($GLOBALS['conf']['thumbnail']['height'], $GLOBALS['conf']['thumbnail']['width']);
} else {
$size = min($this->_params['width'], $this->_params['height']);
}
// Use smartcrop algorithm if we have it, otherwise a plain center crop.
if (Ansel::isAvailable('SmartCrop') && $GLOBALS['conf']['image']['smartcrop']) {
$this->_image->addEffect('SmartCrop', array('width' => $size, 'height' => $size));
} else {
$this->_image->addEffect('CenterCrop', array('width' => $size, 'height' => $size));
}
$this->_image->applyEffects();
if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
try {
$this->_image->addEffect('Unsharpmask', array('radius' => $GLOBALS['conf']['thumbnail']['radius'], 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'], 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
$this->_image->applyEffects();
} catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
return $this->_image->getHordeImage();
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:29,代码来源:SquareThumb.php
示例7: getTile
/**
* Outputs the html for a DateGallery tile.
*
* @param Ansel_Gallery_Decorator_Date $dgallery The Ansel_Gallery_Date we are
* displaying.
* @param Ansel_Style $style A style object.
* @param boolean $mini Force the use of a mini thumbail?
* @param array $params An array containing additional parameters.
* Currently, gallery_view_url and image_view_url
* are used to override the respective urls.
* %g and %i are replaced with image id and
* gallery id, respectively.
*
* @return string The HTML for the tile.
*/
public function getTile(Ansel_Gallery_Decorator_Date $dgallery, Ansel_Style $style = null, $mini = false, array $params = array())
{
$view = $GLOBALS['injector']->createInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/tile');
// User's preferred date format
$date_format = $GLOBALS['prefs']->getValue('date_format');
$date_array = $dgallery->getDate();
if (empty($date_array['month'])) {
$date_array['month'] = 1;
}
if (empty($date_array['day'])) {
$date_array['day'] = 1;
}
$full_date = new Horde_Date($date_array);
// Need the unaltered date part array
$date_array = $dgallery->getDate();
// Figure out the needed link for the next drill down level. We *must*
// have at least a year since we are in a date tile.
if (empty($date_array['month'])) {
// unit == year
$view->caption = $full_date->strftime('%Y');
$next_date = array('year' => (int) $view->caption);
} elseif (empty($date_array['day'])) {
// unit == month
$view->caption = $full_date->strftime('%B %Y');
$next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()));
} else {
// unit == day
$view->caption = $full_date->strftime($date_format);
$next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()), 'day' => date('j', $full_date->timestamp()));
}
// Check permissions on the gallery and get appropriate tile image
if ($dgallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
if (is_null($style)) {
$style = $dgallery->getStyle();
}
$thumbstyle = $mini ? 'mini' : 'thumb';
$view->gallery_image = Ansel::getImageUrl($dgallery->getKeyImage(), $thumbstyle, true, $style);
} else {
$view->gallery_image = Horde_Themes::img('thumb-error.png');
}
/* Check for being called via the api and generate correct view links */
if (!isset($params['gallery_view_url'])) {
if (empty($params['style'])) {
$gstyle = $dgallery->getStyle();
} else {
$gstyle = $params['style'];
}
$params = array('gallery' => $dgallery->id, 'view' => 'Gallery', 'slug' => $dgallery->get('slug'));
$view->view_link = Ansel::getUrlFor('view', array_merge($params, $next_date));
} else {
$view->view_link = new Horde_Url(str_replace(array('%g', '%s'), array($dgallery->id, $dgallery->get('slug')), urldecode($params['gallery_view_url'])));
$view->view_link->add($next_date);
}
$view->gallery_count = $dgallery->countImages(true);
return $view->render('dategallery');
}
开发者ID:jubinpatel,项目名称:horde,代码行数:72,代码来源:DateGallery.php
示例8: __construct
/**
* Const'r
*
* @see Ansel_View_Base::__construct
*/
public function __construct(array $params = array())
{
parent::__construct($params);
if (!empty($params['gallery_slug'])) {
$this->gallery = $this->_getGallery(null, $params['gallery_slug']);
} elseif (!empty($params['gallery_id'])) {
$this->gallery = $this->_getGallery($params['gallery_id']);
} else {
$this->gallery = $this->_getGallery();
}
// Check user age
if (!$this->gallery->isOldEnough()) {
if (!empty($params['api'])) {
throw new Ansel_Exception('Locked galleries are not viewable via the api.');
}
$date = Ansel::getDateParameter(array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0, 'month' => isset($this->_params['month']) ? $this->_params['month'] : 0, 'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));
$galleryurl = Ansel::getUrlFor('view', array_merge(array('gallery' => $this->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Gallery'), $date), true);
$params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
Horde::url('disclamer.php')->add($params)->setRaw(true)->redirect();
exit;
}
if ($this->gallery->hasPasswd()) {
if (!empty($params['api'])) {
throw new Ansel_Exception(_("Locked galleries are not viewable via the api."));
}
$date = Ansel::getDateParameter(array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0, 'month' => isset($this->_params['month']) ? $this->_params['month'] : 0, 'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));
$galleryurl = Ansel::getUrlFor('view', array_merge(array('gallery' => $this->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Gallery'), $date), true);
$params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
Horde::url('protect.php')->add($params)->setRaw(true)->redirect();
exit;
}
if (!$this->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
throw new Horde_Exception_PermissionDenied();
}
// Since this is a gallery view, the resource is the gallery.
$this->resource = $this->gallery;
// Do we have an explicit style set? If not, use the gallery's
if (!empty($this->_params['style'])) {
$style = Ansel::getStyleDefinition($this->_params['style']);
} else {
$style = $this->gallery->getStyle();
}
if (!empty($this->_params['gallery_view'])) {
$renderer = $this->_params['gallery_view'];
} else {
$renderer = !empty($style->gallery_view) ? $style->gallery_view : 'Gallery';
}
// Load the helper
$classname = 'Ansel_View_GalleryRenderer_' . basename($renderer);
$this->_renderer = new $classname($this);
$this->_renderer->init();
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:57,代码来源:Gallery.php
示例9: _create
/**
*
* @return boolean
*/
protected function _create()
{
$this->_image->resize(min($GLOBALS['conf']['screen']['width'], $this->_dimensions['width']), min($GLOBALS['conf']['screen']['height'], $this->_dimensions['height']), true);
if ($GLOBALS['conf']['screen']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
try {
$this->_image->addEffect('Unsharpmask', array('radius' => $GLOBALS['conf']['screen']['radius'], 'threshold' => $GLOBALS['conf']['screen']['threshold'], 'amount' => $GLOBALS['conf']['screen']['amount']));
$this->_image->applyEffects();
} catch (Horde_Image $e) {
throw new Ansel_Exception($e);
}
}
return $this->_image->getHordeImage();
}
开发者ID:jubinpatel,项目名称:horde,代码行数:17,代码来源:Screen.php
示例10: menu
/**
*/
public function menu($menu)
{
global $conf, $registry;
/* Browse/Search */
$menu->add(Horde::url('browse.php'), _("_Browse"), 'ansel-browse', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'browse' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'browse.php' ? 'current' : '__noselection');
if ($GLOBALS['registry']->getAuth()) {
$url = Ansel::getUrlFor('view', array('owner' => $GLOBALS['registry']->getAuth(), 'groupby' => 'owner', 'view' => 'List'));
$menu->add($url, _("_My Galleries"), 'ansel-mygalleries', null, null, null, Horde_Util::getFormData('owner', false) == $GLOBALS['registry']->getAuth() ? 'current' : '__noselection');
}
$menu->add(Ansel::getUrlFor('view', array('view' => 'List')), _("_All Galleries"), 'ansel-allgalleries', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'galleries' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'group.php' && Horde_Util::getFormData('owner') !== $GLOBALS['registry']->getAuth() ? 'current' : '__noselection');
if ($conf['faces']['driver'] && $registry->isAuthenticated()) {
$menu->add(Horde::url('faces/search/all.php'), _("_Faces"), 'ansel-faces');
}
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:Application.php
示例11: _create
/**
*
* @return Horde_Image
*/
protected function _create()
{
$imgobjs = $this->_getStackImages();
$style = $this->_params['style'];
$params = array('width' => 100, 'height' => 100, 'background' => $style->background);
$baseImg = Ansel::getImageObject($params);
try {
$baseImg->addEffect('PhotoStack', array('images' => $imgobjs, 'resize_height' => $GLOBALS['conf']['thumbnail']['height'], 'padding' => 0, 'background' => $style->background, 'type' => 'rounded'));
$baseImg->applyEffects();
$baseImg->resize($GLOBALS['conf']['thumbnail']['width'], $GLOBALS['conf']['thumbnail']['height']);
} catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
return $baseImg;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:RoundedThumbStack.php
示例12: _content
/**
*/
protected function _content()
{
/* Get the tags */
$tags = $GLOBALS['injector']->getInstance('Ansel_Tagger')->getCloud(null, $this->_params['count']);
if (count($tags)) {
$cloud = new Horde_Core_Ui_TagCloud();
foreach ($tags as $id => $tag) {
$link = Ansel::getUrlFor('view', array('view' => 'Results', 'tag' => $tag['tag_name']));
$cloud->addElement($tag['tag_name'], $link, $tag['count']);
}
$html = $cloud->buildHTML();
} else {
$html = '';
}
return $html;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:18,代码来源:Cloud.php
示例13: _create
/**
*
* @return Horde_Image
*/
protected function _create()
{
if ($GLOBALS['conf']['image']['squaremini']) {
$generator = Ansel_ImageGenerator::factory('SquareThumb', array('width' => min(50, $this->_dimensions['width']), 'height' => min(50, $this->_dimensions['height']), 'image' => $this->_image, 'style' => $this->_params['style']));
return $generator->create();
} else {
$this->_image->resize(min(50, $this->_dimensions['width']), min(50, $this->_dimensions['height']), true);
if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
try {
$this->_image->addEffect('Unsharpmask', array('radius' => $GLOBALS['conf']['thumbnail']['radius'], 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'], 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
$this->_image->applyEffects();
} catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
}
return $this->_image->getHordeImage();
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:Mini.php
示例14: _content
/**
*/
protected function _content()
{
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getRandomGallery();
if (!$gallery) {
return _("There are no photo galleries available.");
}
$imagelist = $gallery->listImages(rand(0, $gallery->countImages() - 1), 1);
if (empty($imagelist)) {
return '';
}
$imageId = $imagelist[0];
$viewurl = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'image' => $imageId, 'view' => 'Image'), true);
if ($gallery->isOldEnough() && !$gallery->hasPasswd()) {
$img = '<img src="' . Ansel::getImageUrl($imageId, 'thumb', true, Ansel::getStyleDefinition('ansel_default')) . '" alt="[random photo]" />';
} else {
$img = Horde::img('thumb-error.png');
}
return $viewurl->link(array('title' => _("View Photo"))) . $img . '</a>';
}
开发者ID:jubinpatel,项目名称:horde,代码行数:21,代码来源:RandomPhoto.php
示例15: _content
/**
*/
protected function _content()
{
try {
$gallery = $this->_getGallery();
} catch (Ansel_Exception $e) {
return $e->getMessage();
}
$params = array('gallery_id' => $gallery->id, 'count' => $this->_params['perpage']);
if (!empty($this->_params['use_lightbox'])) {
$params['lightbox'] = true;
}
$html = Ansel::embedCode($params);
// Be nice to people with <noscript>
$viewurl = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id, 'slug' => $gallery->get('slug')), true);
$html .= '<noscript>';
$html .= $viewurl->link(array('title' => sprintf(_("View %s"), $gallery->get('name'))));
if ($iid = $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) && $gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$html .= '<img src="' . Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'thumb', true) . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />';
} else {
$html .= Horde::img('thumb-error.png');
}
return $html . '</a></noscript>';
}
开发者ID:horde,项目名称:horde,代码行数:25,代码来源:Gallery.php
示例16: _getRelatedImages
/**
* Helper function for generating a widget of images related to this one.
*
*
* @return string The HTML
*/
public function _getRelatedImages()
{
$ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
$html = '';
$args = array('typeId' => 'image', 'userId' => $this->_view->gallery->get('owner'));
$results = $GLOBALS['injector']->getInstance('Ansel_Tagger')->listRelatedImages($this->_view->resource);
if (count($results)) {
$i = 0;
foreach ($results as $result) {
$img = $result['image'];
try {
$rGal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($img->gallery);
if ($rGal->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$html .= Ansel::getUrlFor('view', array('image' => $img->id, 'view' => 'Image', 'gallery' => abs($img->gallery), 'slug' => $rGal->get('slug')), true)->link(array('title' => sprintf(_("%s from %s"), $img->filename, $rGal->get('name')))) . '<img src="' . Ansel::getImageUrl($img->id, 'mini', true) . '" alt="' . htmlspecialchars($img->filename) . '" /></a>';
}
} catch (Ansel_Exception $e) {
Horde::log($e->getMessage(), 'ERR');
}
$i++;
}
}
return $html;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:29,代码来源:SimilarPhotos.php
示例17: _content
/**
*/
protected function _content()
{
global $page_output, $registry, $injector, $prefs;
Horde::initMap();
$page_output->addScriptFile('map.js');
$page_output->addScriptFile('blocks/geotag.js');
try {
$images = $injector->getInstance('Ansel_Storage')->getRecentImagesGeodata(null, 0, min($this->_params['limit'], 100));
} catch (Ansel_Exception $e) {
return $e->getMessage();
}
$images = array_reverse($images);
foreach ($images as $key => $image) {
$id = $image['image_id'];
$gallery = $injector->getInstance('Ansel_Storage')->getGallery($image['gallery_id']);
// Don't show locked galleries in the block.
if (!$gallery->isOldEnough() || $gallery->hasPasswd()) {
continue;
}
$style = $gallery->getStyle();
// Generate the image view url
$url = Ansel::getUrlFor('view', array('view' => 'Image', 'slug' => $gallery->get('slug'), 'gallery' => $gallery->id, 'image' => $id, 'gallery_view' => $style->gallery_view), true);
$images[$key]['icon'] = strval(Ansel::getImageUrl($images[$key]['image_id'], 'mini', true));
$images[$key]['link'] = strval($url);
$images[$key]['markerOnly'] = false;
}
// URL for updating selected layer
$layerUrl = $registry->getServiceLink('ajax', 'ansel')->setRaw(true);
$layerUrl->url .= 'setPrefValue';
// And the current defaultLayer, if any.
$defaultLayer = $prefs->getValue('current_maplayer');
$opts = array('layerUpdateEndpoint' => strval($layerUrl), 'layerUpdatePref' => 'current_maplayer', 'defaultBaseLayer' => $defaultLayer);
$json = Horde_Serialize::serialize(array_values($images), Horde_Serialize::JSON);
$js = array('var opts = ' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON), 'new AnselBlockGeoTag(' . $json . ', opts);');
$page_output->addInlineScript($js, true);
return '<div id="ansel_map" style="height:' . $this->_params['height'] . 'px;"></div>';
}
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:RecentlyAddedGeodata.php
示例18: _create
/**
*
* @return Horde_Image
*/
protected function _create()
{
$this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']), min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']), true);
/* Don't bother with these effects for a custom gallery key image
(which will have a negative gallery_id). */
if ($this->_image->gallery > 0) {
if (is_null($this->_style)) {
$gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->_image->gallery);
$styleDef = $gal->getStyle();
} else {
$styleDef = $this->_style;
}
try {
$this->_image->addEffect('PolaroidImage', array('background' => $styleDef->background, 'padding' => 5));
if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
$this->_image->addEffect('Unsharpmask', array('radius' => $GLOBALS['conf']['thumbnail']['radius'], 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'], 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
}
$this->_image->applyEffects();
} catch (Horde_Image_Exception $e) {
throw new Ansel_Exception($e);
}
return true;
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:28,代码来源:PolaroidThumb.php
示例19: _
" />
<p>
<?php
echo _("Drag photos to the desired sort position.");
?>
<input type="submit" onclick="jQuery('#order').val(jQuery('#sortContainer').sortable('serialize', { key: 'order[]' }));" class="button" value="<?php
echo _("Done");
?>
" />
</p>
</form>
</div>
<div id="sortContainer" style="background:<?php
echo $style->background;
?>
">
<?php
$images = $gallery->getImages();
foreach ($images as $image) {
$caption = htmlspecialchars(empty($image->caption) ? $image->filename : $image->caption);
echo '<div id="o_' . (int) $image->id . '"><a title="' . $caption . '" href="#">' . '<img src="' . Ansel::getImageUrl($image->id, 'thumb', false, $style) . '" alt="' . htmlspecialchars($image->filename) . '" />' . '</a></div>';
}
echo '</div>';
?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script>jQuery.noConflict();</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js" type="text/javascript"></script>
<?php
$page_output->footer();
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:sort.php
示例20: catch
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
try {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery((int) Horde_Util::getFormData('gallery'));
} catch (Ansel_Exception $e) {
echo $e->getMessage();
Horde::log($e->getMessage(), 'err');
exit;
}
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
throw new Horde_Exception_PermissionDenied();
}
$style = Ansel::getStyleDefinition('ansel_default');
$style->thumbstyle = 'SquareThumb';
$style->width = 115;
$style->height = 115;
$from = (int) Horde_Util::getFormData('from');
$to = (int) Horde_Util::getFormData('to');
$count = $to - $from + 1;
$old_mode = $gallery->get('view_mode');
$gallery->set('view_mode', 'Normal');
$images = $gallery->getImages($from, $count);
$gallery->set('view_mode', $old_mode);
foreach ($images as $image) {
echo '<li>';
echo '<div>';
$alt = htmlspecialchars($image->filename);
echo '<img src="' . Ansel::getImageUrl($image->id, 'thumb', false, $style) . '" alt="' . $alt . '" title="' . $alt . '" />';
echo '</div></li>' . "\n";
}
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:upload_preview.php
注:本文中的Ansel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论