If SVG width and height are not define, set them to 100%
This commit is contained in:
parent
f86e6b99fa
commit
e4a08effd6
1 changed files with 2 additions and 2 deletions
4
svg.php
4
svg.php
|
@ -175,8 +175,8 @@ class SVG {
|
||||||
$xml = simplexml_load_file($file, SvgNode::class);
|
$xml = simplexml_load_file($file, SvgNode::class);
|
||||||
|
|
||||||
$def = hsc((string) $xml->path['d']);
|
$def = hsc((string) $xml->path['d']);
|
||||||
$w = hsc($xml['width']);
|
$w = hsc($xml['width'] ?? '100%');
|
||||||
$h = hsc($xml['height']);
|
$h = hsc($xml['height'] ?? '100%');
|
||||||
$v = hsc($xml['viewBox']);
|
$v = hsc($xml['viewBox']);
|
||||||
|
|
||||||
return "<svg width=\"$w\" height=\"$h\" viewBox=\"$v\"><path d=\"$def\" /></svg>";
|
return "<svg width=\"$w\" height=\"$h\" viewBox=\"$v\"><path d=\"$def\" /></svg>";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue