mirror of
https://github.com/processwire/processwire.git
synced 2025-08-07 07:16:51 +02:00
Add faster width/height detection for SVG images in Pageimage class
This commit is contained in:
@@ -547,6 +547,13 @@ class Pageimage extends Pagefile {
|
||||
$a = @simplexml_load_string($xml)->attributes();
|
||||
if((int) $a->width > 0) $width = (int) $a->width;
|
||||
if((int) $a->height > 0) $height = (int) $a->height;
|
||||
if((!$width || !$height) && $a->viewBox) {
|
||||
$values = explode(' ', $a->viewBox);
|
||||
if(count($values) === 4) {
|
||||
$width = (int) round($values[2]);
|
||||
$height = (int) round($values[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((!$width || !$height) && (extension_loaded('imagick') || class_exists('\IMagick'))) {
|
||||
@@ -1873,4 +1880,3 @@ class Pageimage extends Pagefile {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user