1

I have an SVG path (I think it's SVG) like so M1368.8,542.2v11.6v19.3h66.9v11.6v15.6h24.9v-15.6h7.1v-11.6h74.9v-19.3v-11.6v-9.5v-21.4 h-91.8h-82v21.4V542.2z M1457.7,542.2v11.6h-6.9v-11.6H1457.7z.

I need to convert it on the fly to polygon coordinates like x,y,x1,y2,x3,y3... and It has to be PHP script.

I had no luck finding any working library, and also I am not sure how to do this myself, because SVG paths tends to be more complicated than simple coordinates (Bézier curves etc.).
Furthermore, I don't know if it would work without some advanced integral-like math magic

Mathew
  • 89
  • 7
  • Unfortunately i need to implement it in PHP script, so no – Mathew Mar 05 '21 at 15:57
  • The code for PHP would be almost the same. Should be very easy to transpile. – Markus Zeller Mar 05 '21 at 16:00
  • Well it isn't since PHP doesn't have a built-in API for SVG manipulation. Moreover, in the question You provided there is no answer how to really do it, and it doesn't explain the logic behind it – Mathew Mar 06 '21 at 17:00
  • It is explained. Another idea is to fill the shape and test the coordinate for color. With a little bit of effort you will some [packages](https://github.com/meyfa/php-svg). – Markus Zeller Mar 06 '21 at 17:12

0 Answers0