Commit 365df977 by sn

inkscape

1 parent 7464c916
...@@ -23,12 +23,10 @@ class mcFile { ...@@ -23,12 +23,10 @@ class mcFile {
@$var_file = fopen($param_filename,$param_kindof); @$var_file = fopen($param_filename,$param_kindof);
if ($var_file === false) { if ($var_file === false) {
return false; return false;
} else { } else {
fputs($var_file, $param_text); fputs($var_file, $param_text);
fputs($var_file, mcCONST::LINEBREAK.mcCONST::LINEBREAK); // fputs($var_file, mcCONST::LINEBREAK.mcCONST::LINEBREAK);
} }
fclose($var_file); fclose($var_file);
return true; return true;
......
...@@ -18,10 +18,28 @@ class mcInkscape { ...@@ -18,10 +18,28 @@ class mcInkscape {
$inkscape_order = "inkscape $param_in_svg -e $param_out_png"; $inkscape_order = "inkscape $param_in_svg -e $param_out_png";
$shell_exec = shell_exec($inkscape_order); $shell_exec = shell_exec($inkscape_order);
D::show($shell_exec, $inkscape_order);
return $param_out_png; return $param_out_png;
} }
/**
*
* @param string $param_svgFileString
*/
public static function svgToPdf($param_in_svg, $param_out_pdf=false) {
if($param_out_pdf === false) {
$param_out_pdf = tempnam("/tmp", "mcInkscape_");
$tmp_png = $param_out_pdf.'.pdf';
mcFile::rename($param_out_pdf, $tmp_png);
$param_out_pdf = $tmp_png;
}
$inkscape_order = "inkscape $param_in_svg -A $param_out_pdf";
$shell_exec = shell_exec($inkscape_order);
return $param_out_pdf;
}
public static function svgToJpg($param_in_svg, $param_out_jpg=false, $param_quality=100) { public static function svgToJpg($param_in_svg, $param_out_jpg=false, $param_quality=100) {
$new_png = mcInkscape::svgToPng($param_in_svg); $new_png = mcInkscape::svgToPng($param_in_svg);
...@@ -31,4 +49,25 @@ class mcInkscape { ...@@ -31,4 +49,25 @@ class mcInkscape {
} }
class mcCairoSvg {
/**
*
* @param string $param_svgFileString
*/
public static function svgToPdf($param_in_svg, $param_out_pdf=false) {
if($param_out_pdf === false) {
$param_out_pdf = tempnam("/tmp", "mcInkscape_");
$tmp_png = $param_out_pdf.'.pdf';
mcFile::rename($param_out_pdf, $tmp_png);
$param_out_pdf = $tmp_png;
}
$inkscape_order = "cairosvg.sh $param_in_svg $param_out_pdf";
$shell_exec = shell_exec($inkscape_order);
return $param_out_pdf;
}
}
?> ?>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!