From: Vincent Vanwaelscappel Date: Mon, 2 Sep 2024 17:47:31 +0000 (+0200) Subject: wip #6998 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d9d54a3bc5342770538b0719629dc3e1d435de48;p=cubist_util.git wip #6998 @1 --- diff --git a/src/Animations/ZipAnimation.php b/src/Animations/ZipAnimation.php index ecfb24e..179a4b5 100644 --- a/src/Animations/ZipAnimation.php +++ b/src/Animations/ZipAnimation.php @@ -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, '
') !== false) { - preg_match('/var animationData = (\{.*\})/', $c, $m); + if (stripos($c, '
') !== false && preg_match('/var animationData = (\{.*\})/', $c, $m)) { $content = trim($m[1]); $ad = json_decode($content, true); $res['width'] = $ad['w']; diff --git a/src/Graphics/Image.php b/src/Graphics/Image.php index f514ae7..faf1dd7 100644 --- a/src/Graphics/Image.php +++ b/src/Graphics/Image.php @@ -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;