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'];
} 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);
}
break;
}
-
}
if (!is_array($res)) {
$res = false;