From d9d54a3bc5342770538b0719629dc3e1d435de48 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 2 Sep 2024 19:47:31 +0200 Subject: [PATCH] wip #6998 @1 --- src/Animations/ZipAnimation.php | 3 +-- src/Graphics/Image.php | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; -- 2.39.5