diff --git a/php/icon.php b/php/icon.php new file mode 100644 index 0000000..b03759e --- /dev/null +++ b/php/icon.php @@ -0,0 +1,164 @@ +setBackgroundColor(new ImagickPixel('#ffffff')); + $image->readImageBlob(file_get_contents($icon_path)); + $image->setImageFormat("png24"); + $image->setImageInterpolateMethod('Integer'); + $image->resizeImage(180, 180, Imagick::FILTER_POINT, 1); + $image->borderImage('#ffffff', 510, 225); + $image->writeImage($preview_path); +} + +// generate color palette +$palette = array(); +$svg = file_get_contents($icon_path); +preg_match_all("/#([0-9a-fA-F]{6})/", $svg, $matches); +$palette = array_unique($matches[0]); +$palette = array_map('strtoupper', $palette); + +// get tags +$icon_json = json_decode(file_get_contents(__DIR__ . "/icons.json"), true); +$tags = $icon_json[$icon_name . ".svg"]; + +?> + + +
+ + + + + + +