'.$testMatch.' is not valid.
';
echo 'Parameter marke-size is not valid (small, medium, large).
';
die();
}
$markerSize = $testMatch; //TODO activate this
$testMatch = NULL;
}
if (isset($_REQUEST["marker-color"]) & $_REQUEST["marker-color"] != "") {
//validate to hex color value
//
//add # before, because # cannot be part of the url
$testMatch = "#".$_REQUEST["marker-color"];
//https://stackoverflow.com/questions/12837942/regex-for-matching-css-hex-colors
$pattern = '/#([a-f0-9]{3}){1,2}\b/i';
if (!preg_match($pattern,$testMatch)){
echo 'Parameter marker-color is not a valid hex color code.
';
die();
}
$markerColor = $testMatch;
$testMatch = NULL;
}
//$e = new mb_exception("color: ".$markerColor);
$key = array_search($marker, $svgFiles);
if (gettype($key) == integer) {
$svgGraphicFilename = $symbolPath.$svgFiles[$key]."-15.svg";
} else {
$svgGraphicFilename = $symbolPath."marker-15.svg";
}
$svgGraphic = file_get_contents($svgGraphicFilename);
//replace color
$svgGraphic = str_replace('setBackgroundColor(new ImagickPixel('transparent'));
$im->readImageBlob($svgGraphic);
switch ($markerSize){
case "medium":
$im->scaleImage(20,20);
break;
case "small":
$im->scaleImage(15,15);
break;
case "large":
$im->scaleImage(25,25);
break;
}
$im->setImageFormat("png32");
header('Content-type: image/png;filename="'.$svgFiles[$key].'-15.svg"');
echo $im;
function cutEndPart(&$item) {
$name = explode('-', $item);
$item = $name[0];
}
?>