]> _ Git - fluidbook_tools.git/commitdiff
wait #5448 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Sep 2022 17:48:51 +0000 (19:48 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 12 Sep 2022 17:48:51 +0000 (19:48 +0200)
src/SVG/SVGTools.php

index 4c08a17c7e7a9256f8b2df56036cfbe712435a3a..c7c5b5fd4049ecc294aa8288f65aa177835a8a2a 100644 (file)
@@ -25,6 +25,18 @@ class SVGTools
         return self::_optimizeSVG($in, $out);
     }
 
+    public static function optimizeSVGStr($in)
+    {
+        $infile = Files::tempnam() . '.svg';
+        file_put_contents($infile, $in);
+        $outfile = Files::tempnam() . '.svg';
+        self::optimizeSVG($infile, $outfile);
+        $res = file_get_contents($outfile);
+        unlink($infile);
+        unlink($outfile);
+        return $res;
+    }
+
     public static function _optimizeSVG($in, $out)
     {