From 6f432d11014371bbb1bcdf906755a9a11ba37532 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 22 May 2023 15:30:40 +0200 Subject: [PATCH] wip #5936 --- src/Compiler/Links.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/Compiler/Links.php b/src/Compiler/Links.php index 2518c08..1bdba83 100644 --- a/src/Compiler/Links.php +++ b/src/Compiler/Links.php @@ -371,33 +371,12 @@ trait Links { } if (stripos($source, '.svg') !== false) { - $source = $this->_fixSVG($source); + $source = \Cubist\Util\Graphics\Image::fixSVGDimensions($source); } $this->vdir->copy($source, $dest); } - protected function _fixSVG($source) { - $fixed = str_replace('.svg', '.f.svg', $source); - if (file_exists($fixed) && filemtime($fixed) >= filemtime($source)) { - return $fixed; - } - $svg = simplexml_load_string(file_get_contents($source)); - $attr = $svg->attributes(); - if (isset($attr['width'], $attr['height'])) { - copy($source, $fixed); - return $fixed; - } - - $dim = Image::getimagesize($source); - $svg->addAttribute('preserveAspectRatio', 'none'); - $svg->addAttribute('width', $dim[0]); - $svg->addAttribute('height', $dim[1]); - file_put_contents($fixed, $svg->asXML()); - - return $fixed; - } - public function getVideosFormats() { return ['mp4', 'jpg']; } -- 2.39.5