throw new \Exception('File ' . $path . ' does not exist');
}
- $allowedExtensions = ['svg', 'oam', 'zip', 'jpeg', 'jpg', 'gif', 'png', 'webm', 'pdf'];
+ $allowedExtensions = ['svg', 'oam', 'zip', 'jpeg', 'jpg', 'gif', 'png', 'webm', 'pdf', 'html'];
$ext = Files::getExtension($path);
if (!in_array($ext, $allowedExtensions)) {
} else if ($ext === 'zip') {
$zip = ZipAnimation::getZIPData($path);
$res = [$zip['width'], $zip['height']];
+ } else if ($ext === 'html') {
+ $htmlContent = file_get_contents($path);
+ if (stristr($htmlContent, '<div id="lottie"></div>')) {
+ if (preg_match('/var animationData = (\{.*\})/', $htmlContent, $m)) {
+ $ad = json_decode(trim($m[1]), true);
+ $res = [$ad['w'], $ad['h']];
+ }
+ }
} else {
$res = getimagesize($path);
}