Location: PHPKode > projects > Wifimap > wifimap/drawlink.php
<?
/*****************************
 * 
 * wifimap v 0.3.1
 *
 * copyright 2003 John O'Sullivan <hide@address.com>
 * Based on some code and ideas from phpwirelessmap
 *
 * This file is part of wifimap.
 * wifimap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * wifimap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with wifimap; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * Licensed under the GNU General Public License
 * See the file COPYING for details
 *
 *****************************/

require("./config.inc.php");

$thisfile="drawlink.php";

Header("Content-type: image/png");
// ensure the image is not 0 pixels high/wide
//if($imagexsize=='') $width = abs($xcl-$xap)+1 else $width=$imagexsize;
//if($imageysize=='') $height = abs($xcl-$xap)+1 else $height=$imageysize;

//$height = abs($ycl-$yap)+1;
// create the image
$image = imagecreatetruecolor($width, $height);
// define colours
$transparent = ImageColorAllocate($image, 0,0,0);
$planned = ImageColorAllocate($image, 2, 2, 2);
$faulty = ImageColorAllocate($image, 250, 0, 0);
// 802.11a (green)
if($protocol=="1") $protocolor = ImageColorAllocate($image, 0, 250, 0);
// 802.11b (blue)
if($protocol=="2") $protocolor = ImageColorAllocate($image, 0, 0, 250);
// 802.11g (cyan)
if($protocol=="3") $protocolor = ImageColorAllocate($image, 0, 250, 250);
imageColorTransparent($image, $transparent);
// fill the image with transparent
imageFilledRectangle($image, 0, 0, $width-1, $height-1, $transparent);
// draw the link
if($linkstatus==1) 
  {
    $style = array ($protocolor,$protocolor,$protocolor);
    imagesetstyle ($image, $style);
    imageline($image, $xcl, $ycl, $xap, $yap, IMG_COLOR_STYLED);
  }
if($linkstatus==2)
  {
    $style = array ($faulty,$faulty,$faulty,$faulty,$faulty,$faulty,$faulty,$faulty,$faulty,$faulty,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor);
    imagesetstyle ($image, $style);
    imageline($image, $xcl, $ycl, $xap, $yap, IMG_COLOR_STYLED);
  }
if($linkstatus==3)
  {
    $style = array ($tranparent,$transparent,$transparent,$transparent,$transparent,$transparent,$transparent,$transparent,$transparent,$transparent,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor,$protocolor);
    imagesetstyle ($image, $style);
    imageline($image, $xcl, $ycl, $xap, $yap, IMG_COLOR_STYLED);
  }
imagePng($image);
imagedestroy($image);
?> 








Return current item: Wifimap