]> _ Git - fluidbook_tools.git/commitdiff
wip #7005 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jul 2024 13:40:24 +0000 (15:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jul 2024 13:40:24 +0000 (15:40 +0200)
src/Jobs/ProcessFile.php

index 4bd729aa9b148ea81a5b72df877301fb9f405d41..fe036b6a70db73c5bf3588432e1cac759b1e4d1f 100644 (file)
@@ -9,6 +9,8 @@ use Fluidbook\Tools\SVG\SVGTools;
 
 class ProcessFile
 {
+    const EMPTY_SVG = '<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>';
+
     protected $format = 'jpg';
     /**
      * @var int|string
@@ -267,11 +269,17 @@ class ProcessFile
             return $svgFile;
         }
         PDFTools::makeBaseSVGFile($this->getSplittedPDFPage(), $svgFile, 1);
+        if (file_exists($svgFile) && filesize($svgFile) == 0) {
+            file_put_contents($svgFile, static::EMPTY_SVG);
+        }
         return $svgFile;
     }
 
     protected function _isSVGValid($file)
     {
+        if (!file_exists($file) || filesize($file) === 0) {
+            return false;
+        }
         $svg = new DOMDocument();
         $svg->preserveWhiteSpace = false;
         $svg->load($file, LIBXML_PARSEHUGE);