Tip: Save to a PHP file and then hit the browser to see the same picture as the image.
<?php
$im =imagecreate (670,500);
$white = Imagecolorallocate ($im, 0xFF, 0xFF, 0xFF);
$g = Imagecolorallocate ($im, 0x00, 0x00, 0x00);
Define ("PII", m_pi/180);
function Drawleaf ($g, $x, $y, $L, $a) {
Global $im;
$B = 50;
$C = 9;
$s 1 = 2;
$s 2 = 3;
$s 3 = 1.2;
if ($L > $s 1)
{
$x 2 = $x + $L * cos ($a * PII);
$y 2 = $y + $L * sin ($a * PII);
$x 2R = $x 2 + $L/$s 2 * cos (($a + $B) * PII);
$y 2R = $y 2 + $L/$s 2 * sin (($a + $B) * PII);
$x 2L = $x 2 + $L/$s 2 * cos (($a-$B) * PII);
$y 2L = $y 2 + $L/$s 2 * sin (($a-$B) * PII);
$x 1 = $x + $L/$s 2 * cos ($a * PII);
$y 1 = $y + $L/$s 2 * sin ($a * PII);
$x 1L = $x 1 + $L/$s 2 * cos (($a-$B) * PII);
$y 1L = $y 1 + $L/$s 2 * sin (($a-$B) * PII);
$x 1R = $x 1 + $L/$s 2 * cos (($a + $B) * PII);
$y 1R = $y 1 + $L/$s 2 * sin (($a + $B) * PII);
Imageline ($im, (int) $x, (int) $y, (int) $x 2, (int) $y 2, $g);
Imageline ($im, (int) $x 2, (int) $y 2, (int) $x 2R, (int) $y 2R, $g);
Imageline ($im, (int) $x 2, (int) $y 2, (int) $x 2L, (int) $y 2L, $g);
Imageline ($im, (int) $x 1, (int) $y 1, (int) $x 1L, (int) $y 1L, $g);
Imageline ($im, (int) $x 1, (int) $y 1, (int) $x 1R, (int) $y 1R, $g);
Drawleaf ($g, $x 2, $y 2, $L/$s 3, $a + $C);
Drawleaf ($g, $x 2R, $y 2R, $L/$s 2, $a + $B);
Drawleaf ($g, $x 2L, $y 2L, $L/$s 2, $a-$B);
Drawleaf ($g, $x 1L, $y 1L, $L/$s 2, $a-$B);
Drawleaf ($g, $x 1R, $y 1R, $L/$s 2, $a + $B);
}
}
Drawleaf ($g, 300,500,100,270);
Header ("Content-type:image/png");
Imagepng ($im);
?>