Skip to content

Instantly share code, notes, and snippets.

@rustedwolf
Last active June 19, 2017 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rustedwolf/8858369 to your computer and use it in GitHub Desktop.
Save rustedwolf/8858369 to your computer and use it in GitHub Desktop.
Converts HTML map cordinates to SVG path.
<?php
function areaToSVGPath($area) {
$mapPoints = explode(',', $area);
$path = "M" . $mapPoints[0];
$delimiter = " ";
for ($i = 1; $i < count($mapPoints); $i++) {
$path .= $delimiter . $mapPoints[$i];
$delimiter = ($delimiter === " ") ? " L" : " ";
}
$path .= "z";
return $path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment