diff --git a/trunk/svgtoimage.php b/trunk/svgtoimage.php index b5bc7e4..c96513a 100644 --- a/trunk/svgtoimage.php +++ b/trunk/svgtoimage.php @@ -1,8 +1,6 @@ hex color because some svg creator uses them @@ -231,7 +229,7 @@ class SVGTOIMAGE{ case 'height': $height = $value; break; case 'href': case 'xlink:href':$href = $value; break; - //case 'r' : $r = $value; break; // no ! + //case 'r' : $r = $value; break; // no, use transform instead ! case 'transform': $transform = $value; case 'style' : if(strripos($value, 'display: none') || strripos($value, 'display:none')) return; break; } @@ -279,13 +277,13 @@ class SVGTOIMAGE{ } $newWidth = imagesx($newImage); $newHeight = imagesy($newImage); - //imagecopy($this->_image,$newImage,$x,$y,0,0, $width , $height); - imagecopy($this->_image,$newImage,($newWidth == $width) ? $x : $x-($newWidth-$width)/2,($newHeight == $height) ? $y : $y-($newHeight-$height)/2,0,0,imagesx($newImage) , imagesy($newImage)); + + imagecopy($this->_image,$newImage,($newWidth == $width) ? $x : $x-($newWidth-$width)/2,($newHeight == $height) ? $y : $y-($newHeight-$height)/2,0,0,imagesx($newImage) , imagesy($newImage)); // Thanks Raphael & GD for saying things wrong. } /* * Check if the given SVG xml is W3C valid - * DEPRECATED + * DEPRECATED and unused anymore * @param string ... * @return boolean */ @@ -665,9 +663,15 @@ class SVGTOIMAGE{ if($this->_showDesc && $this->_desc != null) $this->_parseDescription($this->_desc); //imagefilter ( $this->_image , IMG_FILTER_SMOOTH, 6); switch($format){ + case 'gif' : + header("Content-type: " . image_type_to_mime_type(IMAGETYPE_GIF)); + return imagegif($this->_image, $path); + case 'jpg': + header("Content-type: " . image_type_to_mime_type(IMAGETYPE_JPEG)); + return imagejpeg($this->_image, $path); case 'png' : default : - //header('Content-type: image/png'); + header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG)); return imagepng($this->_image, $path); } } diff --git a/trunk/test.php b/trunk/test.php index 8e0ee4b..26a11d3 100644 --- a/trunk/test.php +++ b/trunk/test.php @@ -39,5 +39,5 @@ $svgtoimage = SVGTOIMAGE::parse($svg); $svgtoimage->setShowDesc(); $svgtoimage->setWidth(300); $svgtoimage->setHeight(512); -header('Content-type: image/png'); +//header('Content-type: image/png'); echo $svgtoimage->toImage(); \ No newline at end of file