function createPNG($props) { try { $req = new DATARequest(); $fullpath = $ADEI_ROOTDIR . "tmp/tmpimg/"; //$fullpath .= $pic; $picname; foreach ($props as $key => $value) { $req->SetProp($key, $value); if ($key == 'db_server' || $key == 'db_name' || $key == 'window') { $picname .= $value . "-"; } } $picname .= rand(1, 200); $picname .= ".png"; $fullpath .= $picname; $draw = $req->CreatePlotter(); $draw->Create(); $draw->Save($fullpath); return $fullpath; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); return "FAILED"; } }
function End($flags = 0) { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } } $res = DRAW::Display($id); $this->h->Write($res); }
function TryPlot(DATARequest $req, &$draw, &$no_data) { try { $draw = $req->CreatePlotter(); $draw->Create(); } catch (ADEIException $ae) { $recovered = false; switch ($ae->getCode()) { case ADEIException::PLOTTER_WINDOW_TOO_SMALL: if (!$req->GetProp('hide_axes')) { $ae->logInfo(NULL, $draw ? $draw : $req); $req->SetProp('hide_axes', 'Y'); TryPlot($req, $draw, $no_data); return translate("To many Y-axes, hidden"); } break; case ADEIException::NO_DATA: case ADEIException::NO_CACHE: case ADEIException::INVALID_REQUEST: if ($draw) { try { $error = $ae->getInfo(); $draw->CreateMessage("Error", $error); $no_data = true; return 0; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); throw $ae; } } break; } throw $ae; } return 0; }
function GetCacheImg($download) { $filename = $this->downloads_path . "/images/{$download}.png"; try { $req = new DATARequest(); $req->SetProp("width", "512"); $req->SetProp("height", "384"); $draw = $req->CreatePlotter(); $draw->Create(); $draw->Save($filename); } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } }
<?php ADEI::RequireClass("draw"); header("Content-type: image/png"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); if (isset($_GET["id"])) { $id = $_GET["id"]; } else { try { $req = new DATARequest(); $draw = $req->CreatePlotter(); $draw->Create(); $id = $draw->Save(); } catch (ADEIException $e) { $error = $e->getInfo(); try { if (!$draw) { if (!$req) { $req = new REQUEST(); } $draw = $req->CreateTextPlotter(); } // $draw->CreateMessage("Error", "No Data"); $draw->CreateMessage("Error", $error); $id = $draw->Save(); $error = false; } catch (ADEIException $ex) { $ex->logInfo(NULL, $draw); } }