From 71a14293b9b142ec4f5ce39fd7f1b03fd56767dd Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 7 Feb 2014 12:58:29 +0000 Subject: [PATCH] --- inc/commons/class.common.tools.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 56fd31e33..ac1359957 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -937,17 +937,19 @@ class commonTools { 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'); @@ -961,10 +963,14 @@ class commonTools { $cl->setArg(null, $dest); $cl->execute(); + ob_end_clean(); + + header('Content-type: image/png'); echo file_get_contents($dest); unlink($src); unlink($dest); + exit; } } -- 2.39.5