AW: Drawing with php. & general question to php.net
| From: | Jörg Hoffmann | Date: | Mon, 02 Oct 2006 10:38:21 +0000 |
| Subject: | AW: Drawing with php. & general question to php.net | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-32885@lists.php.net to get a copy of this message | ||
<form action="io.php" method="post">
and maybe you got an error you haven't understand:
header() must be the first output! (you got the echo '<html>.....' and
everything else above)
Greetings
Jörg H.
And the other question:
Isn't there another way to get help on php? I thought the mailing list is
for real problems. Maybe there should be an mailing list dedicated to
script-questions (but there are enough forums, irc channels and so on...)
-----Ursprüngliche Nachricht-----
Von: Leonard Belfroy [mailto:science@nucleus.com]
Gesendet: Samstag, 30. September 2006 05:17
An: webmaster@php.net
Betreff: Drawing with php.
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.