class_mcInkscape.inc.php
806 Bytes
<?php
class mcInkscape {
/**
*
* @param string $param_svgFileString
*/
public static function svgToPng($param_in_svg, $param_out_png=false) {
if($param_out_png === false) {
$param_out_png = tempnam("/tmp", "mcInkscape_");
$tmp_png = $param_out_png.'.png';
mcFile::rename($param_out_png, $tmp_png);
$param_out_png = $tmp_png;
}
$inkscape_order = "inkscape $param_in_svg -e $param_out_png";
$shell_exec = shell_exec($inkscape_order);
D::show($shell_exec, $inkscape_order);
return $param_out_png;
}
public static function svgToJpg($param_in_svg, $param_out_jpg=false, $param_quality=100) {
$new_png = mcInkscape::svgToPng($param_in_svg);
// D::li('1.1 $new_png: '.$new_png);
return mcImage::pngToJpg($new_png, $param_out_jpg, $param_quality);
}
}
?>