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.
20 lines
496 B
20 lines
496 B
<?php |
|
if (empty($_GET['element']) || empty($_GET['hash'])) { |
|
die('non'); |
|
} |
|
|
|
$element_type = $_GET['element']; |
|
$hash = strtolower($_GET['hash']); |
|
|
|
$file = hexdec($hash[0]); |
|
$color = substr($hash, 1); |
|
|
|
$element = sprintf('elements/%s/%s.svg', $element_type, $file); |
|
while (!file_exists($element)) { |
|
$file--; |
|
$element = sprintf('elements/%s/%s.svg', $element_type, $file); |
|
} |
|
|
|
$svg = file_get_contents($element); |
|
$svg = str_replace('class="colored"', 'fill="#'.$color.'"', $svg); |
|
echo $svg;
|
|
|