Files
michaelschiemer/tests/debug/test-qrcode-png-generation.php
Michael Schiemer 95147ff23e refactor(deployment): Remove WireGuard VPN dependency and restore public service access
Remove WireGuard integration from production deployment to simplify infrastructure:
- Remove docker-compose-direct-access.yml (VPN-bound services)
- Remove VPN-only middlewares from Grafana, Prometheus, Portainer
- Remove WireGuard middleware definitions from Traefik
- Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers

All monitoring services now publicly accessible via subdomains:
- grafana.michaelschiemer.de (with Grafana native auth)
- prometheus.michaelschiemer.de (with Basic Auth)
- portainer.michaelschiemer.de (with Portainer native auth)

All services use Let's Encrypt SSL certificates via Traefik.
2025-11-05 12:48:25 +01:00

72 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\QrCode\QrCodeGenerator;
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
use App\Framework\QrCode\ValueObjects\EncodingMode;
echo "=== PNG QR Code Generation for Testing ===\n\n";
$testData = 'HELLO WORLD';
$config = new QrCodeConfig(
version: QrCodeVersion::fromNumber(1),
errorCorrectionLevel: ErrorCorrectionLevel::M,
encodingMode: EncodingMode::BYTE
);
$matrix = QrCodeGenerator::generate($testData, $config);
$size = $matrix->getSize();
// Generate high-quality PNG
$moduleSize = 20;
$quietZone = 4;
$canvasSize = ($size + 2 * $quietZone) * $moduleSize;
echo "Matrix: {$size}x{$size}\n";
echo "Module size: {$moduleSize}px\n";
echo "Quiet zone: {$quietZone} modules\n";
echo "Canvas: {$canvasSize}x{$canvasSize}px\n\n";
$image = imagecreatetruecolor($canvasSize, $canvasSize);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $white);
$offset = $quietZone * $moduleSize;
for ($row = 0; $row < $size; $row++) {
for ($col = 0; $col < $size; $col++) {
if ($matrix->getModuleAt($row, $col)->isDark()) {
$x = $offset + ($col * $moduleSize);
$y = $offset + ($row * $moduleSize);
imagefilledrectangle(
$image,
$x,
$y,
$x + $moduleSize - 1,
$y + $moduleSize - 1,
$black
);
}
}
}
$outputDir = __DIR__ . '/test-qrcodes';
$filepath = $outputDir . '/scannable-hello-world.png';
imagepng($image, $filepath, 0);
echo "✅ PNG generated: {$filepath}\n";
echo " Size: {$canvasSize}x{$canvasSize}px\n";
echo " File size: " . filesize($filepath) . " bytes\n\n";
echo "This PNG should be scannable.\n";
echo "Please test it with your smartphone scanner.\n";