cvs: pear /Image_Transform/Driver Imagick2.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sat, 21 Apr 2007 20:26:09 +0000 |
| Subject: | cvs: pear /Image_Transform/Driver Imagick2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-46071@lists.php.net to get a copy of this message | ||
dufuz Sat Apr 21 20:26:09 2007 UTC
Modified files:
/pear/Image_Transform/Driver Imagick2.php
Log:
Cosmetics
Fixed Bug #9541 Imagick2 resize() incorrectly maintains aspect ratio, i.e. not how the old Imagick
driver did it
http://cvs.php.net/viewvc.cgi/pear/Image_Transform/Driver/Imagick2.php?r1=1.11&r2=1.12&diff_format=u
Index: pear/Image_Transform/Driver/Imagick2.php
diff -u pear/Image_Transform/Driver/Imagick2.php:1.11 pear/Image_Transform/Driver/Imagick2.php:1.12
--- pear/Image_Transform/Driver/Imagick2.php:1.11 Sat Apr 21 19:27:45 2007
+++ pear/Image_Transform/Driver/Imagick2.php Sat Apr 21 20:26:09 2007
@@ -21,7 +21,7 @@
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
* @copyright 2002-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Imagick2.php,v 1.11 2007/04/21 19:27:45 dufuz Exp $
+ * @version CVS: $Id: Imagick2.php,v 1.12 2007/04/21 20:26:09 dufuz Exp $
* @link http://pear.php.net/package/Image_Transform
*/
@@ -54,6 +54,13 @@
var $imageHandle = null;
/**
+ * Handler of the image ressource before
+ * the last transformation
+ * @var array
+ */
+ var $oldImage;
+
+ /**
* @see __construct()
*/
function Image_Transform_Driver_Imagick2()
@@ -114,7 +121,7 @@
*/
function _resize($new_x, $new_y, $options = null)
{
- if (!imagick_resize($this->imageHandle, $new_x, $new_y, IMAGICK_FILTER_UNKNOWN , 1)) {
+ if (!imagick_resize($this->imageHandle, $new_x, $new_y, IMAGICK_FILTER_UNKNOWN , 1, ,
'!')) {
return $this->raiseError('Couldn\'t resize image.',
IMAGE_TRANSFORM_ERROR_FAILED);
}
@@ -171,27 +178,21 @@
*/
function addText($params)
{
- static $default_params = array(
- 'text' => 'This is a Text',
- 'x' => 10,
- 'y' => 20,
- 'size' => 12,
- 'color' => 'red',
- 'font' => 'Helvetica',
- 'resize_first' => false // Carry out the scaling of
the image before annotation?
- );
- $params = array_merge($default_params, $params);
-
-
- $params['color']=
is_array($params['color'])?$this->colorarray2colorhex($params['color']):strtolower($params['color']);
+ $this->oldImage= $this->imageHandle;
+ $params = array_merge($this->_get_default_text_params(), $params);
+ if (is_array($params['color'])) {
+ $params['color'] = $this->colorarray2colorhex($params['color']);
+ } else {
+ $params['color'] = strtolower($params['color']);
+ }
static $cmds = array(
'setfillcolor' => 'color',
'setfontsize' => 'size',
'setfontface' => 'font'
);
- imagick_begindraw($this->imageHandle ) ;
+ imagick_begindraw($this->imageHandle);
foreach ($cmds as $cmd => $v) {
if (!call_user_func('imagick_' . $cmd, $this->imageHandle, $params[$v])) {
@@ -235,7 +236,11 @@
return $this->raiseError('Couldn\'t save image to file.',
IMAGE_TRANSFORM_ERROR_IO);
}
- $this->free();
+
+ if (!$this->keep_settings_on_save) {
+ $this->free();
+ }
+
return true;
} // End save