1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10: class Horde_Image_Effect_Im_PolaroidImage extends Horde_Image_Effect
11: {
12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
24:
25: 26: 27:
28: protected $_params = array('background' => 'none',
29: 'angle' => 0,
30: 'shadowcolor' => 'black');
31:
32: 33: 34: 35:
36: public function apply()
37: {
38:
39: $this->_image->_imagick = null;
40: $ver = $this->_image->getIMVersion();
41: if (is_array($ver) && version_compare($ver[0], '6.3.2') >= 0) {
42: $this->_image->addPostSrcOperation(sprintf("-bordercolor \"#eee\" -background none -polaroid %s \( +clone -fill %s -draw 'color 0,0 reset' \) +swap +flatten",
43: $this->_params['angle'], $this->_params['background']));
44: } else {
45: $size = $this->_image->getDimensions();
46: $this->_image->addPostSrcOperation(sprintf("-bordercolor \"#eee\" -border 8 -bordercolor grey90 -border 1 -bordercolor none -background none -rotate %s \( +clone -shadow 60x1.5+1+1 -rotate 90 -wave 1x%s -rotate 90 \) +swap -rotate 90 -wave 1x%s -rotate -90 -flatten \( +clone -fill %s -draw 'color 0,0 reset ' \) +swap -flatten",
47: $this->_params['angle'], $size['height'] * 2, $size['height'] * 2, $this->_params['background']));
48: }
49:
50: return true;
51: }
52:
53: }