From: Vincent Vanwaelscappel Date: Wed, 31 May 2023 09:17:09 +0000 (+0200) Subject: wait #5953 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3c00f53a771a3c8bf39c05d703a766695675562f;p=cubist_util.git wait #5953 @0.25 --- 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]);