本文整理汇总了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();
}
}
示例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();
}
示例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();
}
示例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();
}
}
示例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;
}
}
示例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);
}
}