if (!empty($this->_image)) {
$this->_dimensions = $this->_image->_image->getDimensions();
}
+
return $this->_create();
}
'background' => $style['background']);
$baseImg = Ansel::getImageObject($params);
- $result = $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 0,
- 'background' => $style['background'],
- 'type' => 'plain'));
-
- $baseImg->applyEffects();
- if (is_a($result, 'PEAR_Error')) {
- return $result;
+ try {
+ $baseImg->addEffect(
+ 'PhotoStack',
+ array('images' => $imgobjs,
+ 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
+ 'padding' => 0,
+ 'background' => $style['background'],
+ 'type' => 'plain'));
+
+ $baseImg->applyEffects();
+ $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
+ $GLOBALS['conf']['thumbnail']['height']);
+ } catch (Horde_Image_Exception $e) {
+ return false;
}
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
-
return $baseImg;
}
'background' => $style['background']);
$baseImg = Ansel::getImageObject($params);
- $result = $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 10,
- 'background' => $style['background'],
- 'type' => 'polaroid'));
-
- $baseImg->applyEffects();
- if (is_a($result, 'PEAR_Error')) {
- return $result;
+ try {
+ $baseImg->addEffect(
+ 'PhotoStack',
+ array('images' => $imgobjs,
+ 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
+ 'padding' => 10,
+ 'background' => $style['background'],
+ 'type' => 'polaroid'));
+ $baseImg->applyEffects();
+ $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
+ $GLOBALS['conf']['thumbnail']['height']);
+
+ } catch (Horde_Image_Exception $e) {
+ return false;
}
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
-
return $baseImg;
}
} else {
$styleDef = Ansel::getStyleDefinition($this->_style);
}
- $this->_image->_image->addEffect('PolaroidImage',
- array('background' => $styleDef['background'],
- 'padding' => 5));
+ try {
+ $this->_image->_image->addEffect('PolaroidImage',
+ array('background' => $styleDef['background'],
+ 'padding' => 5));
- $this->_image->_image->applyEffects();
+ $this->_image->_image->applyEffects();
+ } catch (Horde_Image_Exception $e) {
+ return false;
+ }
return true;
}
$styleDef = Ansel::getStyleDefinition($this->_style);
}
- /* Apply the effects - continue on error, but be sure to log */
- $res = $this->_image->_image->addEffect('RoundCorners',
- array('border' => 2,
- 'bordercolor' => '#333'));
- if (is_a($res, 'PEAR_Error')) {
- Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
- }
+ try {
+ /* Apply the effects - continue on error, but be sure to log */
+ $this->_image->_image->addEffect('RoundCorners', array('border' => 2,
+ 'bordercolor' => '#333'));
- $res = $this->_image->_image->addEffect('DropShadow',
- array('background' => $styleDef['background'],
- 'padding' => 5,
- 'distance' => 5,
- 'fade' => 3));
- if (is_a($res, 'PEAR_Error')) {
- Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
+ $this->_image->_image->addEffect('DropShadow', array('background' => $styleDef['background'],
+ 'padding' => 5,
+ 'distance' => 5,
+ 'fade' => 3));
+ } catch (Horde_Image_Exception $e) {
+ return false;
}
return $this->_image->_image->applyEffects();
'background' => $style['background']);
$baseImg = Ansel::getImageObject($params);
- $result = $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 0,
- 'background' => $style['background'],
- 'type' => 'rounded'));
-
- $baseImg->applyEffects();
- if (is_a($result, 'PEAR_Error')) {
- return $result;
- }
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
+ 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) {
+ return false;
+ }
return $baseImg;
$styleDef = Ansel::getStyleDefinition($this->_style);
}
- $res = $this->_image->_image->addEffect(
- 'border', array('bordercolor' => '#333'));
-
- $this->_image->_image->addEffect('DropShadow',
- array('background' => $styleDef['background'],
- 'padding' => 5,
- 'distance' => '8',
- 'fade' => 2));
-
- $this->_image->_image->applyEffects();
+ try {
+ $this->_image->_image->addEffect('border', array('bordercolor' => '#333'));
+ $this->_image->_image->addEffect('DropShadow',
+ array('background' => $styleDef['background'],
+ 'padding' => 5,
+ 'distance' => '8',
+ 'fade' => 2));
+ $this->_image->_image->applyEffects();
+ } catch (Horde_Image_Exception $e) {
+ return false;
+ }
return true;
}