From 3c00f53a771a3c8bf39c05d703a766695675562f Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 31 May 2023 11:17:09 +0200 Subject: [PATCH] wait #5953 @0.25 --- src/Graphics/Image.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Graphics/Image.php b/src/Graphics/Image.php index 8a06bbd..f7f21ab 100644 --- a/src/Graphics/Image.php +++ b/src/Graphics/Image.php @@ -71,7 +71,9 @@ class Image $res = [$oam['width'], $oam['height']]; } else if ($ext === 'zip') { $zip = ZipAnimation::getZIPData($path); - $res = [$zip['width'], $zip['height']]; + if (null !== $zip) { + $res = [$zip['width'], $zip['height']]; + } } else if ($ext === 'html') { $htmlContent = file_get_contents($path); if (stristr($htmlContent, '
')) { @@ -104,8 +106,8 @@ class Image } /** - * @throws \Exception * @return string + * @throws \Exception */ public static function fixSVGDimensions($source, $preserveAspectRatio = "none") { @@ -121,7 +123,11 @@ class Image $attr = $svg->attributes(); $dim = self::getimagesize($source); if ($preserveAspectRatio) { - $svg->addAttribute('preserveAspectRatio', $preserveAspectRatio); + if (!isset($attr->preserveAspectRatio)) { + $svg->addAttribute('preserveAspectRatio', $preserveAspectRatio); + } else { + $attr->preserveAspectRatio = $preserveAspectRatio; + } } if (!isset($attr['width'], $attr['height'])) { $svg->addAttribute('width', $dim[0]); -- 2.39.5