Code:
<?php
// create image
$image = imagecreate(500, 350);
// sky backgrounds for random selection
$sky = array("terrain_sky_01.jpg","terrain_sky_02.jpg","terrain_sky_03.jpg");
$random_sky = $sky[rand(0,count($sky)-1)]; // selects a random sky from available ones
// terrain tiles for random selection
$background = array("terrain_tile_01.jpg","terrain_tile_02.jpg","terrain_tile_03.jpg","terrain_tile_04.jpg");
$random_background = $background[rand(0,count($background)-1)]; // selects a random tile from available ones
// define image and colors
$terrain = imagecreatefromjpeg("$random_sky");
imageantialias($terrain,TRUE);
$tile = imagecreatefromjpeg("$random_background");
$bg = imagecolorallocate($terrain, rand(150,255), rand(150,255),rand(150,255));
$fill = imagesettile($terrain,$tile);
// draw a polygon
$points[0] = 0;
$points[1] = 350;
for ($x = 1; $x <= 27; $x++){
$points[$x*2] = round(500/25*($x-1));
$points[$x*2+1] = rand(200, 250);
}
$points[count($points)-1] = 350;
$points[count($points)] = 500;
for ($x=1;$x<=29;$x++){
$bg_points[($x-1)*2] = $points[($x-1)*2];
$bg_points[($x-1)*2+1] = $points[($x-1)*2+1]-3;
}
imagefilledpolygon($terrain, $bg_points, sizeof($points)/2, $bg);
imagefilledpolygon($terrain, $points, sizeof($points)/2, IMG_COLOR_TILED);
// flush image
header('Content-type: image/png');
imagepng($terrain);
imagedestroy($terrain);
?>

now refleash your screen lol
" border="0" alt="tease.gif" />t;line-height:100%">Wirelessly posted (Nokia6630/1.0 (4.03.40) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1)
Comment