我有一个svg图像文件并转换xml以获取宽度和高度的属性,但我没有得到图像的确切宽度和高度。
原始宽度和高度82 * 90像素
SimpleXMLElement Object
(
[@attributes] => Array
(
[width] => 0.908528in
[height] => 0.999992in
[version] => 1.0
[style] => shape-rendering:geometric
转换后的svg显示为
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="100px" height="0px" version="1.0" viewBox="0 0 998 1099">
<defs>
<style type="text/css">
.fil0 {fill:black;fill-rule:nonzero}
</style>
</defs>
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M801 0c97,28 145,67 145,118l-9 22 4 0 57 52c-16,50 -36,75 -61,75 -29,0 -69,-9 -118,-26 -21,46 -31,84 -31,114 17,84 26,151 26,201l0 57c0,12 38,62 114,149 23,21 35,40 35,57 0,12 -13,34 -39,65 -11,30 -24,55 -40,75 0,9 -7,16 -21,22l-5 -5 0 -4 5 -5c-21,0 -31,-23 -31,-70 41,-44 61,-71 61,-78l-171 -145c-16,-29 -26,-44 -30,-44 -19,0 -32,38 -40,114l-8 158c0,61 17,106 52,135 18,15 26,28 26,40 -6,9 -29,14 -70,17 -28,0 -44,-35 -48,-105 -3,-17 -10,-26 -22,-26l0 -4 9 -49c-12,-115 -25,-196 -39,-240l4 -18 -153 -26c-47,9 -70,31 -70,65 -5,43 -29,83 -70,119 -59,38 -88,73 -88,105 0,47 19,88 57,122l0 5c-3,11 -17,17 -39,17l-9 0c-32,0 -48,-13 -48,-39l-9 -193c-55,50 -83,86 -83,110l0 48c0,15 14,49 44,101l-40 13 -4 -5 -4 0 -18 5 -22 -26 0 -18 4 -171 -4 -39c50,-41 74,-82 74,-123l0 -70c0,-48 19,-96 57,-144l0 -5c-46,0 -75,-33 -87,-100l0 -35c7,-33 16,-49 26,-49l9 9 -13 53 0 9c8,55 32,83 70,83 19,-12 70,-24 153,-36l236 -113c60,-31 106,-89 136,-175 39,-97 75,-145 110,-145l30 -4z" fill="#000000"/>
</g>
</svg>