]> _ Git - cubeextranet.git/commitdiff
wait #4186 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 11 Jan 2021 17:13:17 +0000 (17:13 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 11 Jan 2021 17:13:17 +0000 (17:13 +0000)
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/class.ws.tools.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 2f8a9de16962cb0780bb7a05c506c0f0cb671dea..5171da710f1e42b11d6d1c2353d25c096b0969b0 100644 (file)
@@ -16,7 +16,8 @@ class wsExporter
     public $x;
     public $ftpPassiveMode = false;
 
-    const VINCENT = "paris.cubedesigners.com";
+    //const VINCENT = "paris.cubedesigners.com";
+    const VINCENT = "tortuga.enhydra.fr";
 
     public function exportCollection($collectionId, $os)
     {
index 9aa8d1b93cd67008929abdff2f0ca4810e3d4020..51171c8d36ec54d272a5eb604a0ce7edfb931d61 100644 (file)
@@ -57,7 +57,24 @@ class wsTools
         $webvideo->execute();
     }
 
-    public static function optimizeSVG($in, $out)
+
+    public static function optimizeSVG($in, $out = null)
+    {
+        if (null === $out) {
+            $e = explode('.', $in);
+            $ext = array_pop($e);
+            array_push($e, 'o');
+            array_push($e, $ext);
+            $out = implode('.', $e);
+        }
+
+        if (file_exists($out) && filemtime($in) <= filemtime($out)) {
+            return;
+        }
+        return self::_optimizeSVG($in, $out);
+    }
+
+    public static function _optimizeSVG($in, $out)
     {
         $cmd = "timeout -s 1 120 /usr/local/bin/svgcleaner --allow-bigger-file --paths-coordinates-precision 3 --copy-on-error --stdout $in";
         $svg = `$cmd`;
@@ -66,6 +83,7 @@ class wsTools
         }
         $svg = self::_disablePreserveRatio($svg);
         file_put_contents($out, $svg);
+        return $out;
     }
 
     protected static function _disablePreserveRatio($in)
index d03b9543b88b075c256bd6d138f1aaedeab81764..a10d6f12efd2e9c6d8e3460d5c6b555c93794dc9 100644 (file)
@@ -1448,6 +1448,8 @@ class wsHTML5Compiler
 
     protected function addSVGSymbolFromFile($svg, $symbolName)
     {
+        $svg = wsTools::optimizeSVG($svg);
+
         $xml = simplexml_load_string(file_get_contents($svg));
         $viewBox = (string)$xml['viewBox'];