1: <?php
2: 3: 4: 5: 6: 7:
8: class Ansel_ImageGenerator_RoundedThumb extends Ansel_ImageGenerator
9: {
10: public $need = array('RoundCorners', 'DropShadow');
11:
12: public function __construct($params)
13: {
14: parent::__construct($params);
15: $this->title = _("Rounded Corners");
16: }
17:
18: 19: 20: 21:
22: protected function _create()
23: {
24: $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
25: min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
26: true);
27:
28: 29:
30: if ($this->_image->gallery > 0) {
31: if (is_null($this->_style)) {
32: $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($this->_image->gallery);
33: $styleDef = $gal->getStyle();
34: } else {
35: $styleDef = $this->_style;
36: }
37:
38: try {
39:
40: $this->_image->addEffect('RoundCorners', array('border' => 2,
41: 'bordercolor' => '#333'));
42:
43: $this->_image->addEffect('DropShadow', array('background' => $styleDef->background,
44: 'padding' => 5,
45: 'distance' => 5,
46: 'fade' => 3));
47: if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
48: $this->_image->addEffect('Unsharpmask',
49: array('radius' => $GLOBALS['conf']['thumbnail']['radius'],
50: 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'],
51: 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
52: }
53:
54: $this->_image->applyEffects();
55: } catch (Horde_Image_Exception $e) {
56: throw new Ansel_Exception($e);
57: }
58:
59: return $this->_image->getHordeImage();
60: }
61: }
62:
63: }
64: