38769-vm/api/icon.php
2026-02-25 23:13:00 +00:00

19 lines
567 B
PHP

<?php
$size = isset($_GET['size']) ? intval($_GET['size']) : 192;
$size = in_array($size, [192, 512]) ? $size : 192;
$img = imagecreatetruecolor($size, $size);
$bg = imagecolorallocate($img, 26, 38, 57); // #1a2639
imagefill($img, 0, 0, $bg);
$white = imagecolorallocate($img, 255, 255, 255);
$font = 5; // Built in font
$text = "UPTIME";
$fw = imagefontwidth($font) * strlen($text);
$fh = imagefontheight($font);
imagestring($img, $font, ($size - $fw) / 2, ($size - $fh) / 2, $text, $white);
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);