&1";
$output = shell_exec($command);
echo "
Command: $command
";
echo "Output: $output
";
die;
// */
// Do the conversion
$output = shell_exec("java -jar ". BATIK_PATH ." $typeString -d $outfile $width temp/$tempName.svg");
// catch error
if (!is_file($outfile) || filesize($outfile) < 10) {
echo "$output
";
echo "Error while converting SVG. ";
if (strpos($output, 'SVGConverter.error.while.rasterizing.file') !== false) {
echo "
Debug steps
- Copy the SVG:
- Go to validator.w3.org/#validate_by_input
- Paste the SVG
- Click More Options and select SVG 1.1 for Use Doctype
- Click the Check button
";
}
}
// stream it
else {
header("Content-Disposition: attachment; filename=\"$filename.$ext\"");
header("Content-Type: $type");
echo file_get_contents($outfile);
}
// delete it
unlink("temp/$tempName.svg");
unlink($outfile);
// SVG can be streamed directly back
} else if ($ext == 'svg') {
header("Content-Disposition: attachment; filename=\"$filename.$ext\"");
header("Content-Type: $type");
echo $svg;
} else {
echo "Invalid type";
}
?>