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


PHP Ansel::isAvailable方法代码示例

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


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

示例1: _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

示例2: _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

示例3: _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

示例4: _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

示例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 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

示例6: factory

 /**
  * Horde_ImageGenerator factory
  *
  * @param string $type   The type of concrete instance to return.
  * @param array $params  Additional parameters needed for the instance.
  *
  * @return Ansel_ImageGenerator
  * @throws Ansel_Exception
  */
 public static function factory($type, $params = array())
 {
     $type = basename($type);
     $class = 'Ansel_ImageGenerator_' . $type;
     if (class_exists($class)) {
         $view = new $class($params);
         // Check that the image object supports what we need for the effect.
         foreach ($view->need as $need) {
             if (!Ansel::isAvailable($need)) {
                 $err = sprintf(_("This install does not support the %s feature. Please contact your administrator."), $need);
                 Horde::log($err, 'ERR');
                 throw new Ansel_Exception($err);
             }
         }
         return $view;
     } else {
         $err = sprintf(_("Unable to load the definition of %s."), $class);
         Horde::log($err, 'ERR');
         throw new Ansel_Exception($err);
     }
 }
开发者ID:Gomez,项目名称:horde,代码行数:30,代码来源:ImageGenerator.php


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