Drawing with php.
| From: | Leonard Belfroy | Date: | Sat, 30 Sep 2006 03:17:14 +0000 |
| Subject: | Drawing with php. | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-32881@lists.php.net to get a copy of this message | ||
To: Php Group
I have tried to use form data to draw with php language, but php will not assign the form integers
to the imagesetpixel() drawing code. Below is its code:
<?php
echo '<html>
<body>
<form name="io.php" method="post"> x: <input type="text"
name="xx2">
y: <input type="text" name="yy2"> <input type="submit">
<br>
</form>
<br>';
//header(Content-type,png);
//Declare variables:
$xz4=$_POST['xx2'];
$yz4=$_POST['yy2'];
//$xz4=340;
//$yz4=76;
echo $xz4;
echo $yz4;
$xz44=(int)$xz4;
$yz44=(int)$yz4;
$chars="qwxc4";
$image = imageCreateTrueColor(1100, 500); //Set image size.
$white = imageColorAllocate($image, 255, 255, 255); //Make background color.
$black = imageColorAllocate($image,0,0,0); //Make colors:
$blue = imageColorAllocate($image, 0, 0, 255);
imagefill($image,0,0,$white); //Set background color.
imagestring($image, $xz44, $yz44, 0,$chars, $black);
imagesetpixel($image,$xz44,$yz44,$blue);
imageline($image, 255/4, 255/4, 255+(255/4), 255/4, $black);
//header("Content-Type: tex/html/image/png");
imagepng($image,"imaPn.png");
//imagedestroy($image);
echo '<img src="imaPn.png"></body>
</html>';
?>
..
Can someone show how to draw using form data with php.