the effects on
http://www.customink.com/lab/?E=ideas@c ... 511&I=true
Completed:
Normal Text
Curve Text
Arc Text
Roof Text
Wedge Text
Incomplete:
Bridge Text
Valley Text
Bulge Text
I trying to make a nice class that could generate wordart effects because I dont see any class that could do it simply.
here is my source so far:
Code: Select all
<?php
require('svgcurve.php');
$_GET['shape'] = "test";
$_GET['shapesetting'] = "2";
$_GET['text'] = "arial.ttf";
$_GET['textstring'] = "SUPERMAN";
$_GET['textcolor'] = "green";
$_GET['textsize'] = 50;
$_GET['outline'] = "5";
$_GET['outlinecolor'] = "blue";
$_GET['rotatedegree'] = "0";
$_GET['textstring'] = addslashes($_GET['textstring']);
class WordArt
{
var $dataArray;
function WordArt($dataArray)
{
$this->dataArray = $dataArray;
}
function generatetmp($filetype = "tmp")
{
$myFile = tempnam(getcwd(),$filetype);
rename($myFile, basename($myFile,".tmp").".$filetype");
return basename($myFile,".tmp").".$filetype";
}
function drawSVGCurve()
{
$mySVGFile = $this->generatetmp("svg");
$curveamount = -4;
$mysvgcurve = new SVGCurve($this->dataArray['textstring'],$this->dataArray['text'], $curveamount, $this->dataArray['textcolor'], $this->dataArray['textsize'], $this->dataArray['outlinecolor'], $this->dataArray['outline']);
$mysvgcurve->saveSVG($mySVGFile);
shell_exec('java -jar c:\\batik-1.7\batik-rasterizer.jar '.$mySVGFile);
unlink($mySVGFile);
$myFile1 = explode(".",$mySVGFile);
$myFile2 = $myFile1[0].".png";
shell_exec('convert "'.$myFile2.'" -background none -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile2);
}
function drawCurve()
{
if ($this->dataArray['shapesetting'] == 1) //Up Very Sharp
$curveamount = 360;
else if ($this->dataArray['shapesetting'] == 2) //Up Sharp
$curveamount = 180;
else if ($this->dataArray['shapesetting'] == 3) //Up Medium
$curveamount = 90;
else if ($this->dataArray['shapesetting'] == 4) //Up Slight
$curveamount = 45;
else if ($this->dataArray['shapesetting'] == 5) //Up Very Slight
$curveamount = 22.5;
else if ($this->dataArray['shapesetting'] == 6) //Up Super Slight
$curveamount = 11.25;
else if ($this->dataArray['shapesetting'] == 7) //Down Super Slight
$curveamount = 11.25;
else if ($this->dataArray['shapesetting'] == 8) //Down Very Slight
$curveamount = 22.5;
else if ($this->dataArray['shapesetting'] == 9) //Down Slight
$curveamount = 45;
else if ($this->dataArray['shapesetting'] == 10) //Down Medium
$curveamount = 90;
else if ($this->dataArray['shapesetting'] == 11) //Down Sharp
$curveamount = 180;
else if ($this->dataArray['shapesetting'] == 12) //Down Very Sharp
$curveamount = 360;
else
$curveamount = 0;
if ($this->dataArray['shapesetting'] > 6)
{
$rotatearound = 180;
$this->dataArray['rotatedegree'] -= 180;
}
else
$rotatearound = 0;
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
shell_exec('convert '.$myFile2.' -background none -trim -bordercolor none -border 1 -distort Arc "'.$curveamount.' 0" -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile1);
unlink($myFile2);
}
function drawNormal()
{
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
shell_exec('convert '.$myFile2.' -background none -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile1);
unlink($myFile2);
}
function drawArc()
{
if ($this->dataArray['shapesetting'] == 1) //Up Very Small
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 2) //Up Small
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 3) //Up Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 4) //Up Large
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 5) //Up Very Large
$curvesize = 1;
else if ($this->dataArray['shapesetting'] == 6) //Down Very Small
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 7) //Down Small
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 8) //Down Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 9) //Down Large
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 10) //Down Very Large
$curvesize = 1;
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
shell_exec('convert '.$myFile2.' -trim '.$myFile2);
$size = getimagesize($myFile2);
$width = $size[0] * 2;
$height = $size[1];
if ($this->dataArray['shapesetting'] > 5)
shell_exec('convert "'.$myFile2.'" -background none -wave '.($height/$curvesize).'x'.$width.' -chop 0x'.($height/$curvesize).' -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else
shell_exec('convert "'.$myFile2.'" -background none -wave '.(-$height/$curvesize).'x'.$width.' -rotate 180 -chop 0x'.($height/$curvesize).' -rotate '.(180+$this->dataArray['rotatedegree']).' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile1);
unlink($myFile2);
}
function drawWedge()
{
if ($this->dataArray['shapesetting'] == 1) //Up Widen Slow
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 2) //Up Widen Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 3) //Up Winen Fast
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 4) //Up Narrow Slow
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 5) //Up Narrow Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 6) //Up Narrow Fast
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 7) //Middle Widen Slow
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 8) //Middle Widen Medium
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 9) //Middle Widen Fast
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 10) //Middle Widen Slow
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 11) //Middle Widen Medium
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 12) //Middle Widen Fast
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 13) //Down Widen Slow
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 14) //Down Widen Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 15) //Down Winen Fast
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 16) //Down Narrow Slow
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 17) //Down Narrow Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 18) //Down Narrow Fast
$curvesize = 2;
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
shell_exec('convert "'.$myFile2.'" -trim -bordercolor none -border 1 '.$myFile2);
$size = getimagesize($myFile2);
$width = $size[0];
$height = $size[1];
if ($this->dataArray['shapesetting'] == 1 || $this->dataArray['shapesetting'] == 2 || $this->dataArray['shapesetting'] == 3)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,'.($height/$curvesize).' 0,'.$height.',0,'.$height.' '.$width.',0,'.$width.',0 '.$width.','.$height.','.$width.','.$height.'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else if ($this->dataArray['shapesetting'] == 4 || $this->dataArray['shapesetting'] == 5 || $this->dataArray['shapesetting'] == 6)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height.',0,'.$height.' '.$width.',0,'.$width.','.($height/$curvesize).' '.$width.','.$height.','.$width.','.$height.'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else if ($this->dataArray['shapesetting'] == 7 || $this->dataArray['shapesetting'] == 8 || $this->dataArray['shapesetting'] == 9)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,'.($height/$curvesize).' 0,'.$height.',0,'.($height-$height/$curvesize).' '.$width.',0,'.$width.',0 '.$width.','.$height.','.$width.','.$height.'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else if ($this->dataArray['shapesetting'] == 10 || $this->dataArray['shapesetting'] == 11 || $this->dataArray['shapesetting'] == 12)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height.',0,'.$height.' '.$width.',0,'.$width.','.($height/$curvesize).' '.$width.','.$height.','.$width.','.($height-$height/$curvesize).'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else if ($this->dataArray['shapesetting'] == 13 || $this->dataArray['shapesetting'] == 14 || $this->dataArray['shapesetting'] == 15)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height.',0,'.($height-$height/$curvesize).' '.$width.',0,'.$width.',0 '.$width.','.$height.','.$width.','.$height.'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
else if ($this->dataArray['shapesetting'] == 16 || $this->dataArray['shapesetting'] == 17 || $this->dataArray['shapesetting'] == 18)
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height.',0,'.$height.' '.$width.',0,'.$width.',0 '.$width.','.$height.','.$width.','.($height-$height/$curvesize).'" -trim -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile1);
unlink($myFile2);
}
function drawRoof()
{
if ($this->dataArray['shapesetting'] == 1) //Top Small
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 2) //Top Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 3) //Top Large
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 4) //Middle Small
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 5) //Middle Medium
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 6) //Middle Large
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 7) //Bottom Small
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 8) //Bottom Medium
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 9) //Bottom Large
$curvesize = 2;
else if ($this->dataArray['shapesetting'] == 10) //Left Small
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 11) //Left Medium
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 12) //Left Large
$curvesize = 3;
else if ($this->dataArray['shapesetting'] == 13) //Right Small
$curvesize = 5;
else if ($this->dataArray['shapesetting'] == 14) //Right Medium
$curvesize = 4;
else if ($this->dataArray['shapesetting'] == 15) //Right Large
$curvesize = 3;
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
shell_exec('convert "'.$myFile2.'" -trim -bordercolor none -border 1 '.$myFile2);
$size = getimagesize($myFile2);
$width = $size[0];
$height = $size[1];
if ($this->dataArray['shapesetting'] >= 1 && $this->dataArray['shapesetting'] <= 9)
{
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/2).'x'.$height.' '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/2).'x'.$height.'+'.($width/2).'+0 '.$myFile2);
}
else if ($this->dataArray['shapesetting'] >= 10 && $this->dataArray['shapesetting'] <= 12)
{
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/3).'x'.$height.' '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/3*2).'x'.$height.'+'.($width/3).'+0 '.$myFile2);
}
else if ($this->dataArray['shapesetting'] >= 13 && $this->dataArray['shapesetting'] <= 15)
{
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/3*2).'x'.$height.' '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -extent '.($width/3).'x'.$height.'+'.($width/3*2).'+0 '.$myFile2);
}
$size1 = getimagesize($myFile1);
$width1 = $size1[0];
$height1 = $size1[1];
$size2 = getimagesize($myFile2);
$width2 = $size2[0];
$height2 = $size2[1];
if ($this->dataArray['shapesetting'] == 1 || $this->dataArray['shapesetting'] == 2 || $this->dataArray['shapesetting'] == 3)
{
shell_exec('convert "'.$myFile1.'" -background none -distort Bilinear "0,0,0,'.($height1/$curvesize).' 0,'.$height1.',0,'.$height1.' '.$width1.',0,'.$width1.',0 '.$width1.','.$height1.','.$width1.','.$height1.'" '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height2.',0,'.$height2.' '.$width2.',0,'.$width2.','.($height2/$curvesize).' '.$width2.','.$height2.','.$width2.','.$height2.'" '.$myFile2);
}
else if ($this->dataArray['shapesetting'] == 7 || $this->dataArray['shapesetting'] == 8 || $this->dataArray['shapesetting'] == 9)
{
shell_exec('convert "'.$myFile1.'" -background none -distort Bilinear "0,0,0,0 0,'.$height1.',0,'.($height1-$height1/$curvesize).' '.$width1.',0,'.$width1.',0 '.$width1.','.$height1.','.$width1.','.$height1.'" '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height2.',0,'.$height2.' '.$width2.',0,'.$width2.',0 '.$width2.','.$height2.','.$width2.','.($height2-$height2/$curvesize).'" '.$myFile2);
}
else
{
shell_exec('convert "'.$myFile1.'" -background none -distort Bilinear "0,0,0,'.($height1/$curvesize).' 0,'.$height1.',0,'.($height1-$height1/$curvesize).' '.$width1.',0,'.$width1.',0 '.$width1.','.$height1.','.$width1.','.$height1.'" '.$myFile1);
shell_exec('convert "'.$myFile2.'" -background none -distort Bilinear "0,0,0,0 0,'.$height2.',0,'.$height2.' '.$width2.',0,'.$width2.','.($height2/$curvesize).' '.$width2.','.$height2.','.$width2.','.($height2-$height2/$curvesize).'" '.$myFile2);
}
shell_exec('convert '.$myFile1.' '.$myFile2.' -background none +append -rotate '.$this->dataArray['rotatedegree'].' -trim '.$myFile2);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile2));
readfile($myFile2);
unlink($myFile1);
unlink($myFile2);
}
function drawTest()
{
// Function Code By fmw42
$myFile1 = $this->generatetmp("png");
$myFile2 = $this->generatetmp("png");
$myFile3 = $this->generatetmp("jpg");
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile2);
if ($this->dataArray['outline'] > 0)
{
shell_exec('convert -background none -font c:\\windows\\fonts\\'.$this->dataArray['text'].' -fill '.$this->dataArray['textcolor'].' -stroke '.$this->dataArray['outlinecolor'].' -strokewidth '.$this->dataArray['outline'].' -pointsize '.$this->dataArray['textsize'].' label:"'.$this->dataArray['textstring'].'" '.$myFile1);
shell_exec('composite -gravity center '.$myFile2.' '.$myFile1.' '.$myFile2);
}
$height=shell_exec('identify -format %h '.$myFile2);
shell_exec('convert "'.$myFile2.'" -trim -bordercolor none -border '.($height*1).' '.$myFile2);
//input parameter - amount of distortion (smaller is less, larger is more, 0 is no change)
$d=-3; //d ranges from 0 to +1 for barrel and 0 to -1 for pincushion
$a=1+$d;
$b=-$d;
$width=shell_exec('identify -format %w '.$myFile2);
$height=shell_exec('identify -format %h '.$myFile2);
$w2=$width/2;
$h2=$height/2;
$sf=($w2+$h2)/2;
$xc=$w2;
$yc=$h2;
shell_exec('convert -monitor "'.$myFile2.'" -fx "xd=(i-'.$xc.'); yd=(j-'.$yc.'); rd=hypot(xd,yd)/'.$sf.'; ys=(yd/('.$a.'+'.$b.'*rd))+'.$yc.'; u.p{i,ys}" '.$myFile3);
Header('Content-Type: image/png');
Header('Content-Length: '.filesize($myFile3));
readfile($myFile3);
unlink($myFile1);
unlink($myFile2);
unlink($myFile3);
}
}
$myWordArt = new WordArt($_GET);
if ($_GET['shape'] == "normal")
$myWordArt->drawNormal();
else if ($_GET['shape'] == "curve")
$myWordArt->drawCurve();
else if ($_GET['shape'] == "svgcurve")
$myWordArt->drawSVGCurve();
else if ($_GET['shape'] == "arc")
$myWordArt->drawArc();
else if ($_GET['shape'] == "wedge")
$myWordArt->drawWedge();
else if ($_GET['shape'] == "roof")
$myWordArt->drawRoof();
else if ($_GET['shape'] == "test")
$myWordArt->drawTest();
?>
<?PHP
class SVGCurve
{
var $svginformation = "";
function SVGCurve($textstring,$text,$curveamount, $textcolor, $textsize, $outlinecolor, $outline)
{
if (substr_count($text,".") > 0)
{
$textarray = explode(".",$text);
$newstring = "";
for ($i = 0; $i < count($textarray)-1; $i++)
{
$newstring .= $textarray[$i] . ".";
}
$newstring=substr($newstring,0,strlen($newstring)-1);
$text = $newstring;
}
$stringinfo = imagettfbbox ( $textsize , 0 , "c:\\windows\\fonts\\$text.ttf",$textstring);
//print_r($stringinfo);
//$stringinfo[7] is height
//$stringinfo[2] IS length
$offset = -($stringinfo[7]);
$offset2 = $stringinfo[2]-$stringinfo[7];
$this->svginformation .= "<?xml version=\"1.0\" standalone=\"no\"?>";
$this->svginformation .= "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">";
$this->svginformation .= "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" id=\"body\" width=\"".($offset+$stringinfo[2]+$offset)."\" height=\"".($offset2*2)."\">";
$this->svginformation .= "<defs>";
$x1 = $offset;
$y1 = $offset2;
$x2 = $offset+$stringinfo[2];
$y2 = $offset2;
$x3 = $offset+($stringinfo[2]/2);
$y3 = $offset2-($stringinfo[2]/2*$curveamount);
$this->svginformation .= "<path id=\"Curve\" d=\"M $x1 $y1 C $x1 $y1 $x3 $y3 $x2 $y2\" />";
$this->svginformation .= "</defs>";
if ($curveamount > 0)
{
$this->svginformation .= "<text font-family=\"$text\" font-size=\"$textsize\" fill=\"$textcolor\" stroke=\"$outlinecolor\" stroke-width=\"$outline\" >";
$this->svginformation .= "<textPath baseline-shift=\"0%\" xlink:href=\"#Curve\" text-anchor=\"middle\" startOffset=\"50%\">$textstring</textPath>";
$this->svginformation .= "</text>";
$this->svginformation .= "<text font-family=\"$text\" font-size=\"$textsize\" fill=\"$textcolor\">";
$this->svginformation .= "<textPath baseline-shift=\"0%\" xlink:href=\"#Curve\" text-anchor=\"middle\" startOffset=\"50%\">$textstring</textPath>";
$this->svginformation .= "</text>";
}
else
{
$this->svginformation .= "<text font-family=\"$text\" font-size=\"$textsize\" fill=\"$textcolor\" stroke=\"$outlinecolor\" stroke-width=\"$outline\" >";
$this->svginformation .= "<textPath baseline-shift=\"-100%\" xlink:href=\"#Curve\" text-anchor=\"middle\" startOffset=\"50%\">$textstring</textPath>";
$this->svginformation .= "</text>";
$this->svginformation .= "<text font-family=\"$text\" font-size=\"$textsize\" fill=\"$textcolor\">";
$this->svginformation .= "<textPath baseline-shift=\"-100%\" xlink:href=\"#Curve\" text-anchor=\"middle\" startOffset=\"50%\">$textstring</textPath>";
$this->svginformation .= "</text>";
}
$this->svginformation .= "</svg>";
}
function showSVG()
{
header("Content-type: image/svg+xml");
echo $this->svginformation;
}
function saveSVG($myFile)
{
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $this->svginformation;
fwrite($fh, $stringData);
fclose($fh);
}
}
//$mysvg = new SVGCurve("THERE ARE NO COW LEVEL","arial", -4, "blue", 50, "yellow", 5);
//$mysvg->showSVG();
//$mysvg->saveSVG("curveimage.svg");
?>