cvs: pear /Image_Canvas/Canvas GD.php ImageMap.php SVG.php /Image_Canvas/docs ChangeLog

From: Date: Tue, 24 Oct 2006 18:58:17 +0000
Subject: cvs: pear /Image_Canvas/Canvas GD.php ImageMap.php SVG.php /Image_Canvas/docs ChangeLog
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42796@lists.php.net to get a copy of this message
nosey Tue Oct 24 18:58:17 2006 UTC Modified files: /pear/Image_Canvas/docs ChangeLog /pear/Image_Canvas/Canvas ImageMap.php GD.php SVG.php Log: Fixed Bug #8488 "wrong variable name" (thanks to troehr at php dot net) Fixed Bug #8556 "SVG.php contains typo" (thanks to troehr at php dot net) Fixed Bug #9070 "factory method causes PHP error if no GD" (thanks to troehr at php dot net)

http://cvs.php.net/viewvc.cgi/pear/Image_Canvas/docs/ChangeLog?r1=1.21&r2=1.22&diff_format=u Index: pear/Image_Canvas/docs/ChangeLog diff -u pear/Image_Canvas/docs/ChangeLog:1.21 pear/Image_Canvas/docs/ChangeLog:1.22 --- pear/Image_Canvas/docs/ChangeLog:1.21 Wed Mar 22 21:56:04 2006 +++ pear/Image_Canvas/docs/ChangeLog Tue Oct 24 18:58:16 2006 @@ -3,6 +3,12 @@ ************************** Version 0.3.1 [2006-xxx-xx] - Jesper Veggerby <pear.nosey@veggerby.dk> * Modified GD canvas addText() method with TTF fonts - (x, y) parameters now specify the absolute lower-left corner of the text (if angle is 0) instead of the baseline of the first letter, making texts appear incorrectly. This however require fonts to have a steady baseline, like fx. Arial, Verdana, etc. unlike Comic + * Fixed Image_Canvas_PDF to display correctly + * Fixed Request #7285 "UTF-8 in SVGs" + * Fixed Bug #7454 "Vertical axis title is shifted 180 degrees between SVG and PNG output" + * Fixed Bug #8488 "wrong variable name" (thanks to troehr at php dot net) + * Fixed Bug #8556 "SVG.php contains typo" (thanks to troehr at php dot net) + * Fixed Bug #9070 "factory method causes PHP error if no GD" (thanks to troehr at php dot net) Version 0.3.0 [2006-Mar-02] - Jesper Veggerby <pear.nosey@veggerby.dk> * Added clipping (GD uses Image_Canvas method involving ImageCopy(), until native support is available throught existing GD functions gdImageSetClip()) http://cvs.php.net/viewvc.cgi/pear/Image_Canvas/Canvas/ImageMap.php?r1=1.7&r2=1.8&diff_format=u Index: pear/Image_Canvas/Canvas/ImageMap.php diff -u pear/Image_Canvas/Canvas/ImageMap.php:1.7 pear/Image_Canvas/Canvas/ImageMap.php:1.8 --- pear/Image_Canvas/Canvas/ImageMap.php:1.7 Mon Feb 13 20:53:20 2006 +++ pear/Image_Canvas/Canvas/ImageMap.php Tue Oct 24 18:58:16 2006 @@ -25,7 +25,7 @@ * @author Jesper Veggerby <pear.nosey@veggerby.dk> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: ImageMap.php,v 1.7 2006/02/13 20:53:20 nosey Exp $ + * @version CVS: $Id: ImageMap.php,v 1.8 2006/10/24 18:58:16 nosey Exp $ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=212 */ @@ -331,7 +331,7 @@ function save($params = false) { parent::save($params); - $file = fopen($param['filename'], 'w+'); + $file = fopen($params['filename'], 'w+'); fwrite($file, $this->toHtml($params)); fclose($file); } http://cvs.php.net/viewvc.cgi/pear/Image_Canvas/Canvas/GD.php?r1=1.12&r2=1.13&diff_format=u Index: pear/Image_Canvas/Canvas/GD.php diff -u pear/Image_Canvas/Canvas/GD.php:1.12 pear/Image_Canvas/Canvas/GD.php:1.13 --- pear/Image_Canvas/Canvas/GD.php:1.12 Wed Mar 22 21:56:04 2006 +++ pear/Image_Canvas/Canvas/GD.php Tue Oct 24 18:58:16 2006 @@ -29,7 +29,7 @@ * @author Jesper Veggerby <pear.nosey@veggerby.dk> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: GD.php,v 1.12 2006/03/22 21:56:04 nosey Exp $ + * @version CVS: $Id: GD.php,v 1.13 2006/10/24 18:58:16 nosey Exp $ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=212 */ @@ -1774,6 +1774,8 @@ $php_info, $result)) { $version = $result[1]; + } else { + $version = null; } } http://cvs.php.net/viewvc.cgi/pear/Image_Canvas/Canvas/SVG.php?r1=1.14&r2=1.15&diff_format=u Index: pear/Image_Canvas/Canvas/SVG.php diff -u pear/Image_Canvas/Canvas/SVG.php:1.14 pear/Image_Canvas/Canvas/SVG.php:1.15 --- pear/Image_Canvas/Canvas/SVG.php:1.14 Sun May 14 17:44:34 2006 +++ pear/Image_Canvas/Canvas/SVG.php Tue Oct 24 18:58:16 2006 @@ -21,7 +21,7 @@ * @author Jesper Veggerby <pear.nosey@veggerby.dk> * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: SVG.php,v 1.14 2006/05/14 17:44:34 nosey Exp $ + * @version CVS: $Id: SVG.php,v 1.15 2006/10/24 18:58:16 nosey Exp $ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=212 */ @@ -425,6 +425,8 @@ $y1 = $this->_getY($params['y1']); $color = (isset($params['color']) ? $params['color'] : false); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $style = $this->_getLineStyle($color) . $this->_getFillStyle('transparent'); if ($style != '') { $this->_addElement( @@ -434,6 +436,7 @@ 'x2="' . round($x1) . '" ' . 'y2="' . round($y1) . '" ' . 'style="' . $style . '"' . + ($attrs ? ' ' . $attrs : '') . '/>', $params ); @@ -460,6 +463,8 @@ } $style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $first = true; $spline = false; $lastpoint = false; @@ -491,12 +496,13 @@ $first = false; } if ($connectEnds) { - $point .= ' Z'; + $points .= ' Z'; } $this->_addElement( '<path ' . 'd="' . $points . '" ' . 'style="' . $style . '"' . + ($attrs ? ' ' . $attrs : '') . '/>', $params ); @@ -525,6 +531,8 @@ $fillColor = (isset($params['fill']) ? $params['line'] : false); $lineColor = (isset($params['line']) ? $params['line'] : false); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor); if ($style != '') { $this->_addElement( @@ -534,6 +542,7 @@ 'width="' . round(abs($x1 - $x0)) . '" ' . 'height="' . round(abs($y1 - $y0)) . '" ' . 'style="' . $style . '"' . + ($attrs ? ' ' . $attrs : '') . '/>', $params ); @@ -562,6 +571,8 @@ $fillColor = (isset($params['fill']) ? $params['line'] : false); $lineColor = (isset($params['line']) ? $params['line'] : false); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor); if ($style != '') { $this->_addElement( @@ -571,6 +582,7 @@ 'rx="' . round($rx) . '" ' . 'ry="' . round($ry) . '" ' . 'style="' . $style . '"' . + ($attrs ? ' ' . $attrs : '') . '/>', $params ); @@ -607,6 +619,8 @@ $fillColor = (isset($params['fill']) ? $params['line'] : false); $lineColor = (isset($params['line']) ? $params['line'] : false); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $dv = max($v2, $v1) - min($v2, $v1); if ($dv >= 360) { $this->ellipse($params); @@ -626,6 +640,7 @@ round($x2) . ',' . round($y2) . ' ' . 'Z" ' . 'style="' . $style . '"' . + ($attrs ? ' ' . $attrs : '') . '/>', $params ); @@ -683,6 +698,8 @@ $color = (isset($params['color']) ? $params['color'] : false); $alignment = (isset($params['alignment']) ? $params['alignment'] : false); + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + $textHeight = $this->textHeight($text); if (!is_array($alignment)) { @@ -746,7 +763,9 @@ $textColor . ($textOpacity ? ';fill-opacity:' . $textOpacity : '' - ) . ';' . $align . '">' . + ) . ';' . $align . '"' . + ($attrs ? ' ' . $attrs : '') . + '>' . htmlspecialchars($text) . '</text>' . "\n" . $this->_indent . '</g>', @@ -772,6 +791,8 @@ $y = $this->_getY($params['y']); $filename = $params['filename']; + $attrs = (isset($params['attrs']) && is_array($params['attrs'])) ? $this->getAttributes($params['attrs']) : null; + list($width, $height, $type, $attr) = getimagesize($filename); $width = (isset($params['width']) ? $params['width'] : $width); $height = (isset($params['height']) ? $params['height'] : $height); @@ -782,10 +803,12 @@ fclose($file); $data = 'data:' . image_type_to_mime_type($type) . ';base64,' . base64_encode($filedata); + $this->_addElement( '<image xlink:href="' . $data . '" x="' . $x . '" y="' . $y . '"' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . + ($attrs ? ' ' . $attrs : '') . ' preserveAspectRatio="none"/>', $params ); @@ -830,11 +853,16 @@ function show($param = false) { parent::show($param); + + $attrs = (isset($param['attrs']) && is_array($param['attrs'])) ? $this->getAttributes($param['attrs']) : null; + $output = '<?xml version="1.0" encoding="' . $this->_encoding . '"?>' . "\n" . '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"' . "\n\t" . ' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">' . "\n" . '<svg width="' . $this->_width . '" height="' . $this->_height . - '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' . "\n" . + '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"' . + ($attrs ? ' ' . $attrs : '') . + '>' . "\n" . ($this->_defs ? ' <defs>' . "\n" . $this->_defs . @@ -857,11 +885,16 @@ function save($param = false) { parent::save($param); + + $attrs = (isset($param['attrs']) && is_array($param['attrs'])) ? $this->_getAttributes($param['attrs']) : null; + $output = '<?xml version="1.0" encoding="'. $this->_encoding . '"?>' . "\n" . '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"' . "\n\t" . ' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">' . "\n" . '<svg width="' . $this->_width . '" height="' . $this->_height . - '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' . "\n" . + '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"' . + ($attrs ? ' ' . $attrs : '') . + '>' . "\n" . ($this->_defs ? ' <defs>' . "\n" . $this->_defs . @@ -925,7 +958,23 @@ parent::toHtml($params); return '<embed src="' . $params['urlpath'] . $params['filename'] . '" width=' . $params['width'] . ' height=' . $params['height'] . ' type="image/svg+xml">'; } - + + /** + * Converts array of attributes to string + * + * @param array $attrs Attributes array + * @return array + */ + function _getAttributes($attrs) + { + $string = ''; + + foreach ($attrs as $key => $value) { + $string .= ' ' . $key . '="' . $value . '"'; + } + + return $string; + } } ?> \ No newline at end of file
« previous php.pear.cvs (#42796) next »