Click two points to draw a line.
<?# this code is in here since I got 17,000 hits yesterday from someone# using this scriptif (eregi("Simulator",$HTTP_REFERER)) { # please run this script locally, otherwise I will just take it offline header("Location: http://i.cnn.net/cnn/images/main/cnn_logo_260.gif"); exit; } # draws a line based upon cordinates ($x1,$x2,$y1,$y2)# syntax:# image.php?$x1=&$x2=&$y1=&$y2=$x1 = $_REQUEST["x1"];$x2 = $_REQUEST["x2"];$y1 = $_REQUEST["y1"];$y2 = $_REQUEST["y2"];$width = abs($x1-$x2);$height = abs($y1-$y2);$imgOut = ImageCreate($width,$height);$white = ImageColorAllocate($imgOut, 255, 255, 255);$black = ImageColorAllocate($imgOut, 0, 0, 0);$gray = ImageColorAllocate($imgOut, 255, 255, 255);# fill background colorimageFill($imgOut, $width, $height, $white);# get slopeif ($width != 0 && $height != 0) $m = ($x1-$x2)/($y1-$y2); else $m = 0;# draw line based on slopeif ($m >= 0) { imageline($imgOut, 1, 1, $width+1, $height+1, $black); #draw shadow #imageline($imgOut, 0, 0, $width, $height, $black); }else { imageline($imgOut, $width+1, 1, 1,$height+1, $black); #draw shadow #imageline($imgOut, $width, 0, 0,$height, $black); }imagecolortransparent ($imgOut, $white); Header("Content-type: image/png"); ImagePNG($imgOut); ImageDestroy($imgOut);?>