From: vincent@cubedesigners.com Date: Fri, 7 Feb 2014 11:08:11 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d3d8b562e5c40a98bbf7020c9777adf5e343df69;p=cubeextranet.git --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 17c0d2548..56fd31e33 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -935,4 +935,36 @@ class commonTools { return $res; } + public function rasterize() { + $type = isset($_GET['type']) ? $_GET['type'] : 'png'; + $intype = CubeIT_Files::getExtension($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'); + } else if ($intype == 'pdf') { + $cl->setManualArg('-density ' . (round(75 * $scale))); + $cl->setManualArg('-background white'); + } + + if ($intype == 'pdf') { + $cl->setArg(null, $src . '[0]'); + } else { + $cl->setArg(null, $src); + } + $cl->setArg(null, $dest); + $cl->execute(); + + echo file_get_contents($dest); + + unlink($src); + unlink($dest); + } + } diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 507c1d9c8..483eec857 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -878,25 +878,4 @@ class wsServices extends cubeFlashGateway { } } - public function rasterizeSVG() { - $src = cubeFiles::tempnam() . '.svg'; - $dest = cubeFiles::tempnam() . '.png'; - - copy($_GET['svg'], $src); - - $cl = new CubeIT_CommandLine_Imagemagick(); - $cl->setManualArg('-background none'); - $cl->setSrc($src); - $cl->setDest($dest); - $cl->execute(); - - header('Content-type: image/png'); - echo file_get_contents($dest); - - unlink($src); - unlink($dest); - } - } - -?> \ No newline at end of file