1: <?php
2: /**
3: * Image effect for watermarking images with text for the im driver..
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_Imagick_TextWatermark extends Horde_Image_Effect
11: {
12: /**
13: * Valid parameters for watermark effects:
14: *
15: * text (required) - The text of the watermark.
16: * halign - The horizontal placement
17: * valign - The vertical placement
18: * font - The font name or family to use
19: * fontsize - The size of the font to use
20: * (small, medium, large, giant)
21: *
22: * @var array
23: */
24: protected $_params = array('halign' => 'right',
25: 'valign' => 'bottom',
26: 'font' => 'courier',
27: 'fontsize' => 'small');
28:
29: /**
30: * Add the watermark
31: *
32: */
33: public function apply()
34: {
35: /* Determine placement on image */
36: switch ($this->_params['valign']) {
37: case 'bottom':
38: $v = 'south';
39: break;
40: case 'center':
41: $v = 'center';
42: break;
43: default:
44: $v = 'north';
45: }
46:
47: switch ($this->_params['halign']) {
48: case 'right':
49: $h = 'east';
50: break;
51: case 'center':
52: $h = 'center';
53: break;
54: default:
55: $h = 'west';
56:
57: }
58: if (($v == 'center' && $h != 'center') ||
59: ($v == 'center' && $h == 'center')) {
60: $gravity = $h;
61: } elseif ($h == 'center' && $v != 'center') {
62: $gravity = $v;
63: } else {
64: $gravity = $v . $h;
65: }
66: /* Determine font point size */
67: $point = $this->_image->getFontSize($this->_params['fontsize']);
68:
69: //@TODO:
70: throw new Horde_Image_Exception('Not Yet Implemented.');
71: }
72:
73: }