You are here

function pImage::dumpImageMap in Visitors 7.2

Same name and namespace in other branches
  1. 7 pChart/class/pImage.class.php \pImage::dumpImageMap()

File

pChart/class/pImage.class.php, line 406

Class

pImage

Code

function dumpImageMap($Name = "pChart", $StorageMode = IMAGE_MAP_STORAGE_SESSION, $UniqueID = "imageMap", $StorageFolder = "tmp") {
  $this->ImageMapIndex = $Name;
  $this->ImageMapStorageMode = $StorageMode;
  if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION) {
    if (!isset($_SESSION)) {
      session_start();
    }
    if ($_SESSION[$Name] != NULL) {
      foreach ($_SESSION[$Name] as $Key => $Params) {
        echo $Params[0] . IMAGE_MAP_DELIMITER . $Params[1] . IMAGE_MAP_DELIMITER . $Params[2] . IMAGE_MAP_DELIMITER . $Params[3] . IMAGE_MAP_DELIMITER . $Params[4] . "\r\n";
      }
    }
  }
  elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) {
    if (file_exists($StorageFolder . "/" . $UniqueID . ".map")) {
      $Handle = @fopen($StorageFolder . "/" . $UniqueID . ".map", "r");
      if ($Handle) {
        while (($Buffer = fgets($Handle, 4096)) !== false) {
          echo $Buffer;
        }
      }
      fclose($Handle);
      if ($this->ImageMapAutoDelete) {
        unlink($StorageFolder . "/" . $UniqueID . ".map");
      }
    }
  }

  /* When the image map is returned to the client, the script ends */
  exit;
}