Page 1 of 1

How drawing using PHP?

Posted: Wed Nov 13, 2002 1:57 am
by Darginec
Help!
Please, if know write how drawing the diagram?
:wink:

Posted: Wed Nov 13, 2002 2:18 am
by volka
what diagram?
here's a small example (of something ;) )

Code: Select all

<?php
$y1 = (isset($_GETї'startY']))?$_GETї'startY'] : 50;
$y2 = (isset($_GETї'endY']))?$_GETї'endY'] : 50;

$img = imagecreate(100,100);

$color = imagecolorallocate ($img, 200, 200, 200);
imagerectangle($img, 0,0,99,99, $color);

$color = imagecolorallocate ($img, 255, 0, 0);
imageline($img, 0, $y1, 99, $y2, $color);

header('Content-type: image/png');
imagepng($img);
?>
have a look at http://www.php.net/manual/en/ref.image.php

Posted: Wed Nov 13, 2002 5:59 am
by Heavy
volka wrote:

Code: Select all

<?php
$y1 = (isset($_GETї'startY']))?$_GETї'startY'] : 50;
$y2 = (isset($_GETї'endY']))?$_GETї'endY'] : 50;
?>
What does "?" and ":" mean?

Posted: Wed Nov 13, 2002 6:13 am
by twigletmac
heavy -

Code: Select all

$y1 = (isset($_GETї'startY']))?$_GETї'startY'] : 50;
This would equate to:

Code: Select all

if (isset($_GETї'startY'])) {
   $y1 = $_GETї'startY'];
} else {
   $y1 = 50;
}
Mac

Posted: Thu Jul 22, 2004 6:07 am
by Jeph

Posted: Thu Jul 22, 2004 6:16 am
by JayBird
Why reply to a topic that is nearly 2 years old :)

You had me thinking Twig was back