1: <?php
2: /**
3: * Image effect for adding a drop shadow.
4: *
5: * Copyright 2007-2012 Horde LLC (http://www.horde.org/)
6: *
7: * @author Michael J. Rubinsky <mrubinsk@horde.org>
8: * @package Image
9: */
10: class Horde_Image_Effect_Im_DropShadow extends Horde_Image_Effect
11: {
12: /**
13: * Valid parameters: Most are currently ignored for the im version
14: * of this effect.
15: *
16: * @TODO
17: *
18: * @var array
19: */
20: protected $_params = array('distance' => 5, // This is used as the x and y offset
21: 'width' => 2,
22: 'hexcolor' => '000000',
23: 'angle' => 215,
24: 'fade' => 3, // Sigma value
25: 'padding' => 0,
26: 'background' => 'none');
27:
28: /**
29: * Apply the effect.
30: *
31: * @return mixed true
32: */
33: public function apply()
34: {
35: $size = $this->_image->getDimensions();
36: $this->_image->addPostSrcOperation('\( +clone -background black -shadow 80x' . $this->_params['fade'] . '+' . $this->_params['distance'] . '+' . $this->_params['distance'] . ' \) +swap -background none -flatten +repage -bordercolor ' . $this->_params['background'] . ' -border ' . $this->_params['padding']);
37: $this->_image->clearGeometry();
38:
39: return true;
40: }
41:
42: }