当前位置: 首页>>代码示例>>PHP>>正文


PHP Ansel::getErrorImage方法代码示例

本文整理汇总了PHP中Ansel::getErrorImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Ansel::getErrorImage方法的具体用法?PHP Ansel::getErrorImage怎么用?PHP Ansel::getErrorImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ansel的用法示例。


在下文中一共展示了Ansel::getErrorImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getImageUrl

 /**
  * Return a link to an image, suitable for use in an <img/> tag
  * Takes into account $conf['vfs']['direct'] and other
  * factors.
  *
  * @param string $imageId     The id of the image.
  * @param string $view        The view ('screen', 'thumb', 'full', 'mini')
  *                            to show.
  * @param boolean $full       Return a path that includes the server name?
  * @param Ansel_Style $style  Use this gallery style
  *
  * @return Horde_Url The image path.
  */
 public static function getImageUrl($imageId, $view = 'screen', $full = false, Ansel_Style $style = null)
 {
     global $conf;
     if (empty($imageId)) {
         return Horde::url((string) Ansel::getErrorImage($view), $full);
     }
     // Default to ansel_default
     if (is_null($style)) {
         $style = Ansel::getStyleDefinition('ansel_default');
     }
     // Don't load the image if the view exists
     $viewHash = Ansel_Image::viewExists($imageId, $view, $style);
     if ($conf['vfs']['src'] != 'php' && $viewHash === false) {
         // We have to make sure the image exists first, since we won't
         // be going through img/*.php to auto-create it.
         try {
             $image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage($imageId);
         } catch (Exception $e) {
             Horde::log($e, 'ERR');
             return Horde::url((string) Ansel::getErrorImage($view), $full);
         }
         try {
             $image->createView($view, $style, $GLOBALS['prefs']->getValue('watermark_auto') && $view == 'screen' ? $GLOBALS['prefs']->getValue('watermark_text', '') : '');
         } catch (Ansel_Exception $e) {
             return Horde::url((string) Ansel::getErrorImage($view), $full);
         }
         $viewHash = $image->getViewHash($view, $style) . '/' . $image->getVFSName($view);
     }
     // First check for vfs-direct. If we are not using it, pass this off to
     // the img/*.php files, and check for sendfile support there.
     if ($conf['vfs']['src'] != 'direct') {
         $params = array('image' => $imageId);
         if (!is_null($style)) {
             $params['t'] = $style->thumbstyle;
             $params['b'] = $style->background;
             if ($style->width) {
                 $params['w'] = $style->width;
             }
             if ($style->height) {
                 $params['h'] = $style->height;
             }
         }
         return Horde::url('img/' . $view . '.php', $full)->add($params);
     }
     // Using vfs-direct
     $path = substr(str_pad($imageId, 2, 0, STR_PAD_LEFT), -2) . '/' . $viewHash;
     if ($full && substr($conf['vfs']['path'], 0, 7) != 'http://') {
         return Horde::url($conf['vfs']['path'] . $path, true, -1);
     } else {
         return new Horde_Url($conf['vfs']['path'] . htmlspecialchars($path));
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:65,代码来源:Ansel.php


注:本文中的Ansel::getErrorImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。