salut tout le monde , j´ai utilisé la librarie GD pour faire un petit programme :
le voila :
< ?
if ( isset($_POST[´ab1´]) AND isset($_POST[´ab2´]) AND isset($_POST[´or1´]) AND isset($_POST[´or2´])) {
$variable1 = $_POST[´ab1´];
$variable2 = $_POST[´ab2´];
$variable3 = $_POST[´or1´];
$variable4 = $_POST[´or2´];
}
else {
$variable1 = " ";
$variable2 = " ";
$variable3 = " ";
$variable4 = " ";
}
? >
< ?
$image = imagecreate(500,500);
$bleuclair = imagecolorallocate($image, 156, 227, 254);
$bleufonce = imagecolorallocate($image, 77, 24, 231);
$rouge = imagecolorallocate($image, 240, 88, 15);
ImageFilledRectangle ( $image, 10,10, 50, 50, $bleufonce);
ImageFilledEllipse ( $image, 85, 60, 45, 45, $rouge);
$points = array(35, 99, 199, 110, 165, 250);
$deux = array(35, 99, 25, 220, 165, 250);
$trois = array(35, 99, 220, 99, 199, 110);
$quatre = array(199, 110, 220, 99, 165, 250);
ImagePolygon ( $image, $points, 3, $rouge);
ImagePolygon ( $image, $deux, 3, $rouge);
ImagePolygon ( $image, $trois, 3, $rouge);
ImagePolygon ( $image, $quatre, 3, $rouge);
ImageLine ( $image, $variable1, $variable3, $variable2, $variable4, $bleufonce);
imagepng($image,"nomimage.png");
? >
< html>
< head>
< title> < /title>
< /head>
< body>
< img src="nomimage.png">
< form action="image2.php" method="POST">
< br>
absisse x : < input type="text" name="ab1"><br>
ordonnée y : < input type="text" name="or1"><br>
absisse x : < input type="text" name="ab2"><br>
ordonnée y : < input type="text" name="or2"><br>
< input type="submit">
< /form>
< /form>
< /html>
Au fait, ca doit juste faire une droite !
Sauf que quand on réentre les 4 valeurs , ca crée une autre droite et ca efface l´ancienne , donc j´ai essayé d´utilisé une base de données avec 5 champs , mais cela ne fonctionne pas :
< html>
< head>
< title> < /title>
< /head>
< body>
< ?
if ( isset($_POST[´ab1´]) AND isset($_POST[´ab2´]) AND isset($_POST[´or1´]) AND isset($_POST[´or2´])) {
$ab1 = $_POST[´ab1´];
$ab2 = $_POST[´ab2´];
$or1 = $_POST[´or1´];
$or2 = $_POST[´or2´];
mysql_connect("localhost", " root", " "); / / Connexion à MySQL
mysql_select_db("forum"); / / Sélection de la base mateo21
$sql = ´INSERT INTO `dessin` ( `id` , `ax` , `ox` , `ay` , `oy` ) ´
. ´ VALUES ( \´\´, \´$ab1\´, \´$or1\´, \´$ab2\´, \´$or2\´ ) ;´
. ´ ´;
$reponse = mysql_query(SELECT * FROM dessin where ax=´$ab1´);
while ( $donnees = mysql_fetch_array($reponse))
{
$variable_finale_un= $donnees[´ax´];
$variable_finale_deux= $donnees[´ox´];
$variable_finale_trois= $donnees[´ay´];
$variable_finale_quatre= $donnees[´oy´];
}
mysql_close(); / / Déconnexion de MySQL
}
? >
< ?
$image = imagecreate(500,500);
$bleuclair = imagecolorallocate($image, 156, 227, 254);
$bleufonce = imagecolorallocate($image, 77, 24, 231);
$rouge = imagecolorallocate($image, 240, 88, 15);
ImageFilledRectangle ( $image, 10,10, 50, 50, $bleufonce);
ImageFilledEllipse ( $image, 85, 60, 45, 45, $rouge);
$points = array(35, 99, 199, 110, 165, 250);
$deux = array(35, 99, 25, 220, 165, 250);
$trois = array(35, 99, 220, 99, 199, 110);
$quatre = array(199, 110, 220, 99, 165, 250);
ImagePolygon ( $image, $points, 3, $rouge);
ImagePolygon ( $image, $deux, 3, $rouge);
ImagePolygon ( $image, $trois, 3, $rouge);
ImagePolygon ( $image, $quatre, 3, $rouge);
ImageLine ( $image, ´$variable_finale_un´, ´$variable_finale_deux´, ´$variable_finale_trois´, ´$variable_finale_quatre´, $bleufonce);
imagepng($image,"nomimage.png");
? >
< img src="nomimage.png">
< form action="image3.php" method="POST">
< br>
absisse x : < input type="text" name="ab1"><br>
ordonnée x : < input type="text" name="or1"><br>
absisse y : < input type="text" name="ab2"><br>
ordonnée y : < input type="text" name="or2"><br>
< input type="submit">
< /form>
< /form>
< /html>
Voila pour les deux il fo creer une base de donnée nommé " forum" et une table nommée " dessin"
Le premier marche mais pas le deuxieme...