]> _ Git - fluidbook_tools.git/commitdiff
wip #5863 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 14 Apr 2023 14:21:44 +0000 (16:21 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 14 Apr 2023 14:21:44 +0000 (16:21 +0200)
src/Jobs/ProcessFile.php
src/SVG/SVGTools.php

index ff2b327b6b6fe0278171c0ac007939be6c39cf7e..c85e2247dc36748dce1e0306095e6facd1365ee8 100644 (file)
@@ -246,11 +246,11 @@ class ProcessFile {
         return $this->getJob()->getMobileFirstRatio();
     }
 
+
+
     public function makeOptimizedSVGFile($out) {
         $in = $this->makeSVGFile();
         SVGTools::optimizeSVGImages($in, $out, $this->getResolution());
-        $beforeOpt = str_replace('.svg', '.orig.svg', $out);
-        copy($out, $beforeOpt);
         SVGTools::optimizeSVG($out, $out);
     }
 
index 64fe55ed28473fd4728aafb487291f29f2961a22..1fcb6be2fb86f04d977e166cc99d68110b8ab6bc 100644 (file)
@@ -54,6 +54,9 @@ class SVGTools {
 
     public static function _optimizeSVG($in, $out) {
 
+        $beforeOpt = str_replace('.svg', '.orig.svg', $in);
+        copy($in, $beforeOpt);
+
         $svg = shell_exec('timeout -s 1 120 ' . FluidbookTools::tools_path('svgcleaner/svgcleaner', true) . ' --allow-bigger-file --paths-coordinates-precision 3 --copy-on-error --stdout ' . $in);
         if (!$svg) {
             $svg = file_get_contents($in);
@@ -153,7 +156,7 @@ class SVGTools {
         $cli->setArg('s', $source);
         $cli->setArg('d', $dest);
         $cli->execute();
-        if(!stristr($cli->getOutput(),'done')){
+        if (!stristr($cli->getOutput(), 'done')) {
 
             $cli->dd();
         }