]> _ Git - fluidbook_tools.git/commitdiff
wait #6516 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 Nov 2023 17:35:14 +0000 (18:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 Nov 2023 17:35:14 +0000 (18:35 +0100)
src/Links/Link.php

index 93bba02132353b3a8945f565a4ba9983ec529c59..c05ddb384abcf24b7882dae792710d7c82a4dcc3 100644 (file)
@@ -823,18 +823,21 @@ class Link
 
     public function getConfigHTML($d, $html)
     {
-        $c = file_get_contents($this->compiler->working_path($html));
-        $res = array('width' => $this->video_width, 'height' => $this->video_height);
-        if (stristr($c, '<div id="lottie"></div>')) {
-            if (preg_match('/var animationData = (\{.*\})/', $c, $m)) {
-                $ad = json_decode(trim($m[1]), true);
-                $res['width'] = $ad['w'];
-                $res['height'] = $ad['h'];
+        if (Files::isNotEmpty($html)) {
+            $c = file_get_contents($this->compiler->working_path($html));
+            $res = array('width' => $this->video_width, 'height' => $this->video_height);
+            if (stristr($c, '<div id="lottie"></div>')) {
+                if (preg_match('/var animationData = (\{.*\})/', $c, $m)) {
+                    $ad = json_decode(trim($m[1]), true);
+                    $res['width'] = $ad['w'];
+                    $res['height'] = $ad['h'];
+                }
             }
-        }
-        $r = array('type' => 'html', 'html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
+            $r = ['type' => 'html', 'html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()];
 
-        return array_merge($res, $r);
+            return array_merge($res, $r);
+        }
+        return [];
     }
 
     public function getConfigOAM($d)
@@ -847,7 +850,6 @@ class Link
 
         $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html');
 
-
         $res = array('type' => 'oam', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array(), 'content' => trim($c->content), 'name' => $c->_name, 'assets' => array());
         foreach ($c->properties->property as $p) {
             if (isset($props[$p->_name])) {