<?php
$gdfont = '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf';
$image = imageCreate(640,480);
$colorRed = imageColorAllocate($image, 255,0,0);
$colorYellow = imageColorAllocate($image, 255,255,0);
imageFilledRectangle($image, 50, 50, 590, 430, $colorYellow);
$colorBlack = imagecolorallocate($image, 0, 0, 0);
// add text
$i = 100;
$c = 0;
$x2 = 0;
$y2 = 100;
for ($a=0; $a<=360; $a+=15) {
$colorX = imagecolorallocate($image,$c,$c,$c);
$b = imagettftext($image,12,$a,$i+$x2,$i+$y2,$colorX,$gdfont,
"Hello, Worldy! $a/$c");
imagepolygon($image,$b,$colorX);
if ($c > 0) {
if (($a % 90) == 0) {
switch ($a / 90) {
case 1:
$x2 = 250;
$y2 = 0;
break;
case 2:
$x2 = 0;
$y2 = 300;
break;
case 3:
$x2 = 250;
$y2 = 200;
break;
}
}
}
$c += 8;
}
// Set type of image and send the output
header("Content-type: image/jpeg");
imageJpeg($image);
imageDestroy($image);
?>