public function rasterize() {
$type = isset($_GET['type']) ? $_GET['type'] : 'png';
- $intype = CubeIT_Files::getExtension($src);
+ $intype = CubeIT_Files::getExtension($_GET['src']);
$src = cubeFiles::tempnam() . '.' . $intype;
$dest = cubeFiles::tempnam() . '.' . $type;
copy($_GET['src'], $src);
+
+
$scale = isset($_GET['scale']) ? $_GET['scale'] : 1;
$cl = new CubeIT_CommandLine('convert');
if ($intype == 'svg') {
- $cl->setManualArg('-background none');
+ $cl->setManualArg('-background none -flatten');
} else if ($intype == 'pdf') {
$cl->setManualArg('-density ' . (round(75 * $scale)));
$cl->setManualArg('-background white');
$cl->setArg(null, $dest);
$cl->execute();
+ ob_end_clean();
+
+ header('Content-type: image/png');
echo file_get_contents($dest);
unlink($src);
unlink($dest);
+ exit;
}
}