43 lines
1.7 KiB
PHP
43 lines
1.7 KiB
PHP
<?php
|
|
/* V75 Avatar SVG — meeting-rooms style (emoji on colored disc) */
|
|
header('Content-Type: image/svg+xml; charset=utf-8');
|
|
header('Cache-Control: public, max-age=86400');
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
$name = $_GET['n'] ?? 'Agent';
|
|
$emoji = $_GET['e'] ?? '👤';
|
|
$size = max(40, min(400, intval($_GET['s'] ?? 200)));
|
|
|
|
$hash = crc32($name);
|
|
$hues = [12, 30, 45, 85, 160, 180, 210, 265, 300, 330];
|
|
$hue = $hues[abs($hash) % count($hues)];
|
|
$sat = 65 + (abs($hash >> 4) % 20);
|
|
$bgc = "hsl({$hue}, {$sat}%, 88%)";
|
|
$ringc = "hsl({$hue}, {$sat}%, 45%)";
|
|
$shadowc = "hsl({$hue}, {$sat}%, 30%)";
|
|
|
|
$name_safe = htmlspecialchars($name, ENT_XML1);
|
|
$emoji_safe = htmlspecialchars($emoji, ENT_XML1);
|
|
|
|
$svg = <<<SVG
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" width="{$size}" height="{$size}" role="img" aria-label="{$name_safe}">
|
|
<defs>
|
|
<radialGradient id="g" cx="50%" cy="35%" r="65%">
|
|
<stop offset="0%" stop-color="white" stop-opacity=".85"/>
|
|
<stop offset="70%" stop-color="{$bgc}" stop-opacity="1"/>
|
|
<stop offset="100%" stop-color="{$shadowc}" stop-opacity=".35"/>
|
|
</radialGradient>
|
|
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%">
|
|
<feGaussianBlur stdDeviation="2"/>
|
|
</filter>
|
|
</defs>
|
|
<circle cx="100" cy="100" r="95" fill="url(#g)" stroke="{$ringc}" stroke-width="3" stroke-opacity=".55"/>
|
|
<circle cx="100" cy="100" r="90" fill="none" stroke="white" stroke-width="1.5" stroke-opacity=".7"/>
|
|
<text x="100" y="100" font-size="108" text-anchor="middle" dominant-baseline="central"
|
|
font-family="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji','Twemoji Mozilla',sans-serif"
|
|
filter="url(#sh)">{$emoji_safe}</text>
|
|
</svg>
|
|
SVG;
|
|
|
|
echo $svg;
|