You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
496 B
PHTML
21 lines
496 B
PHTML
3 years ago
|
<?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;
|