mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-02-16 02:30:51 +00:00
Add export graph to svg
This commit is contained in:
@@ -39,6 +39,20 @@ function getImageFileName($graphName, $fromRoot=false)
|
||||
return $dirName . "/$graphName.png";
|
||||
}
|
||||
|
||||
function getSvgFileName($graphName, $fromRoot=false)
|
||||
{
|
||||
global $g_config;
|
||||
|
||||
$dirName = ($fromRoot ? "" : "../") . $g_config['graphSavePath'] . substr($graphName, 0, 2);
|
||||
|
||||
if(!file_exists($dirName))
|
||||
{
|
||||
mkdir($dirName, 0777, true);
|
||||
}
|
||||
|
||||
return $dirName . "/$graphName.svg";
|
||||
}
|
||||
|
||||
|
||||
function saveGraphXML($graph, $name, $fromRoot = false)
|
||||
{
|
||||
|
||||
19
cgi-bin/saveSvg.php
Normal file
19
cgi-bin/saveSvg.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
include ("../core/config/main.php");
|
||||
include ("saveGraphHelpers.php");
|
||||
|
||||
$name = $_GET["name"];
|
||||
|
||||
if (isValidName($name))
|
||||
{
|
||||
$imageFilename = getSvgFileName($name);
|
||||
$svgData = $_POST['svgdata'];
|
||||
|
||||
file_put_contents($imageFilename, $svgData);
|
||||
|
||||
chmod($imageFilename, 0644);
|
||||
echo ("OK");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user