SVG to picture converter in PHP http://labs.shikiryu.com/svgtoimage/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.php 1.4KB

12345678910111213141516171819202122
  1. <?
  2. include 'svgtoimage.php';
  3. /*
  4. <image x="184" y="286" width="10" height="10" preserveAspectRatio="none" href="imageurl4.png" style="cursor: pointer; opacity: 1; display: none; " opacity="1"></image>
  5. <image x="204" y="286" width="10" height="10" preserveAspectRatio="none" href="imageurl5.png" style="cursor: pointer; opacity: 1; display: none; " opacity="1"></image>
  6. */
  7. $svg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="600" height="512">
  8. <desc>Created with Raphael</desc>
  9. <defs></defs>
  10. <image x="0" y="0" width="300" height="512" preserveAspectRatio="none" href="http://labs.shikiryu.com/experimental-cut/images/pieces/fond.jpg"></image>
  11. <rect x="168" y="275" width="52" height="70" r="0" rx="0" ry="0" fill="none" stroke="#FFF" stroke-dasharray="8,3" transform="rotate(21.91207728 194 310)" style="opacity: 1; display: none; " opacity="1"></rect>
  12. <circle cx="50" cy="50" r="50" fill="#FFFFFF" stroke="#000"></circle>
  13. <image x="170" y="277" width="48" height="66" preserveAspectRatio="none" href="http://labs.shikiryu.com/experimental-cut/images/pieces/1.png" style="cursor: move; opacity: 1; " r="90" opacity="1" transform="rotate(21.91207728 194 310)"></image>
  14. </svg>';
  15. //$svgtoimage = new SVGTOIMAGE($svg);
  16. $svgtoimage = SVGTOIMAGE::load('basic.svg');
  17. $svgtoimage->setShowDesc();
  18. $svgtoimage->setWidth(300);
  19. $svgtoimage->setHeight(512);
  20. header('Content-type: image/png');
  21. echo $svgtoimage->toImage();