"php": ">=7.2",\r
"php-mime-mail-parser/php-mime-mail-parser": "2.11.1",\r
"jaybizzle/crawler-detect": "^1.2",\r
- "ext-mbstring": "*"\r
+ "ext-mbstring": "*",\r
+ "ext-simplexml": "*"\r
}\r
}\r
$dest = $dest;
}
+ if (stripos($source, '.svg') !== false) {
+ $source = $this->_fixSVG($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 = CubeIT_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 addVideoJs()
{
$locale = $this->book->lang;