Files
2026-05-16 23:00:37 -05:00

54 lines
2.0 KiB
PHP

<?php
/**
* Tom's Java Jive - Generate PWA Icons
* Creates basic SVG icons for PWA manifest
*/
$sizes = [72, 96, 128, 144, 152, 192, 384, 512];
$outputDir = __DIR__ . '/../assets/icons/';
if (!is_dir($outputDir)) {
mkdir($outputDir, 0755, true);
}
// Generate a simple coffee cup icon as SVG
$svgTemplate = '<?xml version="1.0" encoding="UTF-8"?>
<svg width="{SIZE}" height="{SIZE}" viewBox="0 0 {SIZE} {SIZE}" xmlns="http://www.w3.org/2000/svg">
<rect width="{SIZE}" height="{SIZE}" rx="{RADIUS}" fill="#FF5E1A"/>
<g transform="translate({OFFSET}, {OFFSET}) scale({SCALE})">
<path fill="#FFF8F0" d="M60 20H20c-2.2 0-4 1.8-4 4v44c0 6.6 5.4 12 12 12h24c6.6 0 12-5.4 12-12V24c0-2.2-1.8-4-4-4zm-8 4v4H28v-4h24zm8 44c0 4.4-3.6 8-8 8H28c-4.4 0-8-3.6-8-8V32h40v36z"/>
<path fill="#FFF8F0" d="M72 32h-4v8h4c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-4v8h4c6.6 0 12-5.4 12-12v-8c0-6.6-5.4-12-12-12z"/>
<path fill="#FFF8F0" opacity="0.6" d="M32 12c0-2.2 1.8-4 4-4s4 1.8 4 4v4h-8v-4zm12 0c0-2.2 1.8-4 4-4s4 1.8 4 4v4h-8v-4zm12 0c0-2.2 1.8-4 4-4s4 1.8 4 4v4h-8v-4z"/>
</g>
</svg>';
foreach ($sizes as $size) {
$radius = floor($size * 0.15);
$offset = floor($size * 0.1);
$scale = $size / 100;
$svg = str_replace(
['{SIZE}', '{RADIUS}', '{OFFSET}', '{SCALE}'],
[$size, $radius, $offset, $scale],
$svgTemplate
);
// Save as SVG
file_put_contents($outputDir . "icon-{$size}.svg", $svg);
echo "Generated icon-{$size}.svg\n";
}
// Also create badge icon
$badgeSvg = '<?xml version="1.0" encoding="UTF-8"?>
<svg width="72" height="72" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg">
<circle cx="36" cy="36" r="36" fill="#FF5E1A"/>
<text x="36" y="45" font-family="Arial, sans-serif" font-size="28" font-weight="bold" fill="white" text-anchor="middle">TJ</text>
</svg>';
file_put_contents($outputDir . 'badge-72.svg', $badgeSvg);
echo "Generated badge-72.svg\n";
echo "\nDone! Icons generated in: $outputDir\n";
echo "Note: For production, convert SVGs to PNGs using an image tool.\n";