Thursday, May 31, 2012

Creating a bus Image In PHP using Graphics


<?
$img=imagecreatetruecolor(600,600);
$grey=imagecolorallocate($img,200,191,191);
$brown=imagecolorallocate($img,152,50,50);

imagerectangle($img,245,155,516,253,$grey); //bus
imagerectangle($img,442,96,511,154,$grey); //top-square

imageline($img,244,172,516,172,$grey);
imageline($img,244,232,516,232,$white);

imagefilledrectangle($img,280,180,302,197,$grey); //window1
imagefilledrectangle($img,354,180,376,196,$grey); //window2
imagefilledrectangle($img,424,180,446,196,$grey); //window3

imagefilledellipse($img,295,275,50,50,$brown); //wheel left-outer
imagefilledellipse($img,295,275,20,17,$grey); //wheel left-inner
imagefilledellipse($img,440,280,50,50,$brown); //wheel right-outer
imagefilledellipse($img,440,280,20,17,$grey); //wheel right-inner

header('Content-Type:image/png');
imagePNG($img);
imagepng($img,"t4.png");
imagedestroy($img);
?>

No comments:

Post a Comment