]> _ Git - cubist_util.git/commitdiff
wip #6998 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Sep 2024 17:47:31 +0000 (19:47 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Sep 2024 17:47:31 +0000 (19:47 +0200)
src/Animations/ZipAnimation.php
src/Graphics/Image.php

index ecfb24ec25938b3b197681656ca70d65bc220fd6..179a4b5fb0fa32278b4a415f90101a83d605627c 100644 (file)
@@ -16,8 +16,7 @@ class ZipAnimation extends OAMAnimation
         if (file_exists($index)) {
             $c = Text::normalizeLines(file_get_contents($index));
             $res['html'] = $c;
-            if (stripos($c, '<div id="lottie"></div>') !== false) {
-                preg_match('/var animationData = (\{.*\})/', $c, $m);
+            if (stripos($c, '<div id="lottie"></div>') !== false && preg_match('/var animationData = (\{.*\})/', $c, $m)) {
                 $content = trim($m[1]);
                 $ad = json_decode($content, true);
                 $res['width'] = $ad['w'];
index f514ae7361ad3869529a2e9e063ec2185d58aee2..faf1dd71112e2a59993e7fcd19de0fa7271f4a2a 100644 (file)
@@ -92,7 +92,9 @@ class Image
         } else if ($ext === 'zip') {
             $zip = ZipAnimation::getZIPData($path);
             if (null !== $zip) {
-                $res = [$zip['width'], $zip['height']];
+                if(isset($zip['width']) && isset($zip['height'])) {
+                    $res = [$zip['width'], $zip['height']];
+                }
             }
         } else if ($ext === 'html') {
             $lottie = Lottie::getAnimationDataFromHTMLFile($path);
@@ -107,7 +109,6 @@ class Image
                 }
                 break;
             }
-
         }
         if (!is_array($res)) {
             $res = false;