note 49433 added to ref.image
| From: | shadikka at ihatespam dot gmail dot com | Date: | Thu, 27 Jan 2005 19:42:46 +0000 |
| Subject: | note 49433 added to ref.image | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84085@lists.php.net to get a copy of this message | ||
Two stickfigures with different colors:
<?php
// 0
$img = imagecreatetruecolor(300,300);
$bgcol = imagecolorallocate($img,255,255,255);
$hatcol = imagecolorallocate($img,rand(128,255),rand(128,255),rand(128,255));
$headcol = imagecolorallocate($img,255,225,205);
$bodycol = imagecolorallocate($img,0,0,0);
$eyecol = imagecolorallocate($img,rand(100,200),rand(0,128),rand(128,255));
$mouthcol = imagecolorallocate($img,rand(128,255),0,0);
imagefill($img,0,0,$bgcol);
// 1
imagefilledellipse($img,60,71,50,50,$headcol);
imagefilledpolygon($img,array(30,53,60,23,90,53),3,$hatcol);
imagesetthickness($img,5);
imageline($img,60,97,60,201,$bodycol);
imagesetthickness($img,1);
imagefilledellipse($img,50,65,7,5,$eyecol);
imagefilledellipse($img,70,65,7,5,$eyecol);
imagesetthickness($img,8);
imageline($img,60,201,10,251,$bodycol);
imageline($img,60,201,110,251,$bodycol);
imageline($img,60,136,10,186,$bodycol);
imageline($img,60,136,110,186,$bodycol);
imagesetthickness($img,3);
imageline($img,50,80,60,90,$mouthcol);
imageline($img,60,90,70,80,$mouthcol);
// 2
$hatcol = imagecolorallocate($img,rand(128,255),rand(128,255),rand(128,255));
$headcol = imagecolorallocate($img,255,225,205);
$bodycol = imagecolorallocate($img,0,0,0);
$eyecol = imagecolorallocate($img,rand(100,200),rand(0,128),rand(128,255));
$mouthcol = imagecolorallocate($img,rand(128,255),0,0);
imagefilledellipse($img,200,71,50,50,$headcol);
imagefilledpolygon($img,array(170,53,200,23,230,53),3,$hatcol);
imagesetthickness($img,5);
imageline($img,200,97,200,201,$bodycol);
imagesetthickness($img,1);
imagefilledellipse($img,190,65,7,5,$eyecol);
imagefilledellipse($img,210,65,7,5,$eyecol);
imagesetthickness($img,8);
imageline($img,200,201,150,251,$bodycol);
imageline($img,200,201,250,251,$bodycol);
imageline($img,200,136,150,186,$bodycol);
imageline($img,200,136,250,186,$bodycol);
imagesetthickness($img,3);
imageline($img,190,80,200,90,$mouthcol);
imageline($img,200,90,210,80,$mouthcol);
// 3
imagestring($img,2,223,283,"(C) Shadikka",$bodycol);
imagesetthickness($img,1);
imagerectangle($img,0,0,299,299,$bodycol);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
I have used most basic image functions in the code.
----
Manual Page -- http://www.php.net/manual/en/ref.image.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49433
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49433&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49433&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49433&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49433&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49433&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49433&report=yes
Search -- http://master.php.net/manage/user-notes.php