Files
michaelschiemer/tests/debug/test-svg-with-correct-parameters.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

67 lines
2.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\QrCode\QrCodeGenerator;
use App\Framework\QrCode\QrCodeRenderer;
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
use App\Framework\QrCode\ValueObjects\EncodingMode;
use App\Framework\QrCode\ValueObjects\QrCodeStyle;
echo "=== SVG with Correct Parameters ===\n\n";
$config = new QrCodeConfig(
version: QrCodeVersion::fromNumber(1),
errorCorrectionLevel: ErrorCorrectionLevel::M,
encodingMode: EncodingMode::BYTE
);
$matrix = QrCodeGenerator::generate('HELLO WORLD', $config);
// The problematic SVG has:
// - Canvas: 580x580
// - Module size: 20
// - Quiet zone: 80px (4 modules)
// Create style with matching parameters
$style = new QrCodeStyle(
moduleSize: 20,
quietZoneSize: 4, // 4 modules = 80px with 20px modules
darkColor: null, // Will use default black
lightColor: null // Will use default white
);
$renderer = new QrCodeRenderer();
$svg = $renderer->renderCustom($matrix, $style, false);
echo "Generated SVG with matching parameters:\n";
echo " Module size: 20px\n";
echo " Quiet zone: 4 modules (80px)\n";
echo " Canvas size should be: " . (21 * 20 + 2 * 80) . "x" . (21 * 20 + 2 * 80) . "\n";
echo " SVG length: " . strlen($svg) . " bytes\n\n";
// Check actual canvas size
if (preg_match('/width="(\d+)" height="(\d+)"/', $svg, $matches)) {
echo "Actual canvas size: {$matches[1]}x{$matches[2]}\n";
$expectedSize = 21 * 20 + 2 * 80; // 580
if ((int)$matches[1] === $expectedSize && (int)$matches[2] === $expectedSize) {
echo "✅ Canvas size matches!\n";
} else {
echo "❌ Canvas size doesn't match (expected: {$expectedSize}x{$expectedSize})\n";
}
}
// Save to file
$outputDir = __DIR__ . '/test-qrcodes';
$filepath = $outputDir . '/hello-world-correct-params.svg';
file_put_contents($filepath, $svg);
echo "\n✅ Saved: {$filepath}\n";
echo "This should match the parameters of the problematic SVG.\n";
echo "Compare this with the problematic SVG to find differences.\n";