title: PHP using imagecreatefromstring to convert an SVG string to image
body: <p>The following javascript code will convert an SVG string into a image blob that can then be used to display in a browser:</p>
  
  <pre><code> var data = '&lt;svg xmlns="http://www.w3.org/2000/svg" width="390" height="65"&gt;' +
          '&lt;rect x="0" y="0" width="100%" height="100%" fill="#7890A7" stroke-width="20" stroke="#ffffff" &gt;&lt;/rect&gt;' +
          '&lt;foreignObject x="15" y="10" width="100%" height="100%"&gt;' +
          '&lt;div xmlns="http://www.w3.org/1999/xhtml" style="font-size:40px"&gt;' +
          ' &lt;em&gt;I&lt;/em&gt; am' +
          '&lt;span style="color:white; text-shadow:0 0 20px #000000;"&gt;' +
          ' HTML in SVG!&lt;/span&gt;' +
          '&lt;/div&gt;' +
          '&lt;/foreignObject&gt;' +
          '&lt;/svg&gt;';
  
      var DOMURL = window.URL || window.webkitURL || window;
  
      var img = new Image();
      var svg = new Blob([data], {type: 'image/svg+xml;charset=utf-8'});
      var url = DOMURL.createObjectURL(svg);
  </code></pre>
  
  <p>The trouble is that i want to be able to do this same thing but in PHP. I thought about using the <code>imagecreatefromstring</code> function. Is that the right way to go about it?</p>