title: how to extract height and width from a svg file
body: <p>example:</p>
  
  <pre><code>&lt;svg width="23" height="22" xmlns="http://www.w3.org/2000/svg"&gt;
  &lt;!-- Created with SVG-edit - http://svg-edit.googlecode.com/ --&gt;
  &lt;g&gt;
  &lt;title&gt;Layer 1&lt;/title&gt;
  &lt;path fill-opacity="0" id="svg_1" d="m23,2-20,9.5l22,9" stroke-width="4" stroke="#000000" fill="#ffffff" /&gt;
  &lt;/g&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>I want to extract the width and height of the svg file so that I can do some positioning with canvg.</p>
  
  <p>I know it's xml, but I can't figure it out.  It's probably something really easy but it's the last day of the year and I can't figure it out.</p>
  
  <p>Been trying:</p>
  
  <p>PHP SimpleXML</p>
  
  <pre><code>$xml = simplexml_load_file($imageright) or die("Error: Cannot create object");
  print_r($xml-&gt;getDocNamespaces());echo '&lt;/br&gt;';
  </code></pre>
  
  <p>giving me 
      Array ( [] => <a href="http://www.w3.org/2000/svg" rel="nofollow">http://www.w3.org/2000/svg</a> ) </p>
  
  <p>This also doesn't work:</p>
  
  <pre><code>foreach($xml-&gt;svg[0]-&gt;attributes() as $a =&gt; $b)
    {
    echo $a,'="',$b,"\"&lt;/br&gt;";
    }
  </code></pre>
  
  <p>Any ideas?</p>