- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
170 lines
5.6 KiB
PHP
170 lines
5.6 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 "=== QR Code Reference Comparison ===\n\n";
|
|
|
|
// Bekannte Referenz-QR-Code-Daten für "HELLO WORLD"
|
|
// Diese sind aus der ISO/IEC 18004 Spezifikation oder bekannten QR-Code-Generatoren
|
|
$data = "HELLO WORLD";
|
|
|
|
echo "Generiere für: '{$data}'\n\n";
|
|
|
|
$config = new QrCodeConfig(
|
|
version: QrCodeVersion::fromNumber(1),
|
|
errorCorrectionLevel: ErrorCorrectionLevel::M,
|
|
encodingMode: EncodingMode::BYTE
|
|
);
|
|
|
|
$matrix = QrCodeGenerator::generate($data, $config);
|
|
$size = $matrix->getSize();
|
|
|
|
// Erstelle eine kompakte Hex-Darstellung
|
|
echo "=== Matrix als Hex (jede Zeile) ===\n";
|
|
for ($row = 0; $row < $size; $row++) {
|
|
$bits = '';
|
|
for ($col = 0; $col < $size; $col++) {
|
|
$bits .= $matrix->getModuleAt($row, $col)->isDark() ? '1' : '0';
|
|
}
|
|
|
|
// Konvertiere zu Hex (padding auf 24 bits = 3 bytes = 6 hex chars)
|
|
$bits = str_pad($bits, 24, '0');
|
|
$hex = '';
|
|
for ($i = 0; $i < strlen($bits); $i += 4) {
|
|
$nibble = substr($bits, $i, 4);
|
|
$hex .= dechex(bindec($nibble));
|
|
}
|
|
|
|
echo sprintf("Row %2d: %s\n", $row, $hex);
|
|
}
|
|
|
|
echo "\n=== Prüfe kritische Bereiche ===\n\n";
|
|
|
|
// 1. Version Information (sollte für V1 nicht vorhanden sein)
|
|
echo "Version Information: N/A (Version 1)\n\n";
|
|
|
|
// 2. Format Information
|
|
echo "Format Information:\n";
|
|
$formatCols = [0, 1, 2, 3, 4, 5, 7, 8, 20, 19, 18, 17, 16, 15, 14];
|
|
$formatBits = '';
|
|
foreach ($formatCols as $col) {
|
|
$formatBits .= $matrix->getModuleAt(8, $col)->isDark() ? '1' : '0';
|
|
}
|
|
echo "Horizontal (Row 8): {$formatBits}\n";
|
|
|
|
$formatRows = [20, 19, 18, 17, 16, 15, 14, 8, 7, 5, 4, 3, 2, 1, 0];
|
|
$formatBitsV = '';
|
|
foreach ($formatRows as $row) {
|
|
$formatBitsV .= $matrix->getModuleAt($row, 8)->isDark() ? '1' : '0';
|
|
}
|
|
echo "Vertical (Col 8): {$formatBitsV}\n";
|
|
echo "Match: " . ($formatBits === $formatBitsV ? "✅ Yes" : "❌ No") . "\n\n";
|
|
|
|
// 3. Erstelle ein "visually perfect" Bild
|
|
echo "=== Generiere perfekt ausgerichtetes PNG ===\n";
|
|
|
|
$scale = 20;
|
|
$quietZone = 4;
|
|
$totalSize = ($size + 2 * $quietZone) * $scale;
|
|
|
|
$image = imagecreate($totalSize, $totalSize);
|
|
$white = imagecolorallocate($image, 255, 255, 255);
|
|
$black = imagecolorallocate($image, 0, 0, 0);
|
|
|
|
// Fill background
|
|
imagefill($image, 0, 0, $white);
|
|
|
|
// Draw each module as perfect square
|
|
for ($row = 0; $row < $size; $row++) {
|
|
for ($col = 0; $col < $size; $col++) {
|
|
if ($matrix->getModuleAt($row, $col)->isDark()) {
|
|
$x = ($quietZone + $col) * $scale;
|
|
$y = ($quietZone + $row) * $scale;
|
|
|
|
// Draw perfect square (no gaps)
|
|
for ($dy = 0; $dy < $scale; $dy++) {
|
|
for ($dx = 0; $dx < $scale; $dx++) {
|
|
imagesetpixel($image, $x + $dx, $y + $dy, $black);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$filepath = '/var/www/html/public/qrcode-perfect-pixel.png';
|
|
imagepng($image, $filepath, 0); // 0 = no compression
|
|
|
|
echo "✅ Perfect PNG: qrcode-perfect-pixel.png\n";
|
|
echo " Size: {$totalSize}x{$totalSize}px\n";
|
|
echo " No compression, pixel-perfect rendering\n\n";
|
|
|
|
// Verify das generierte Bild
|
|
$verify = imagecreatefrompng($filepath);
|
|
$vWidth = imagesx($verify);
|
|
$vHeight = imagesy($verify);
|
|
|
|
echo "Verification:\n";
|
|
echo " Image dimensions: {$vWidth}x{$vHeight}\n";
|
|
|
|
// Check quiet zone
|
|
$qzPixel = imagecolorat($verify, 0, 0);
|
|
$qzColor = imagecolorsforindex($verify, $qzPixel);
|
|
echo " Quiet zone (0,0): RGB({$qzColor['red']}, {$qzColor['green']}, {$qzColor['blue']})\n";
|
|
|
|
// Check first finder module
|
|
$fmX = ($quietZone * $scale) + ($scale / 2);
|
|
$fmY = ($quietZone * $scale) + ($scale / 2);
|
|
$fmPixel = imagecolorat($verify, (int)$fmX, (int)$fmY);
|
|
$fmColor = imagecolorsforindex($verify, $fmPixel);
|
|
echo " Finder module: RGB({$fmColor['red']}, {$fmColor['green']}, {$fmColor['blue']})\n\n";
|
|
|
|
// Generiere auch BMP (manchmal besser für Scanner)
|
|
echo "=== Generiere BMP Version ===\n";
|
|
$bmpPath = '/var/www/html/public/qrcode-test.bmp';
|
|
|
|
// BMP Header erstellen (Windows 24-bit BMP)
|
|
$filesize = 54 + ($totalSize * $totalSize * 3); // Header + pixel data
|
|
$bmpData = pack('v', 0x4D42); // 'BM'
|
|
$bmpData .= pack('V', $filesize);
|
|
$bmpData .= pack('V', 0); // Reserved
|
|
$bmpData .= pack('V', 54); // Offset to pixel data
|
|
|
|
// DIB Header (BITMAPINFOHEADER)
|
|
$bmpData .= pack('V', 40); // Header size
|
|
$bmpData .= pack('V', $totalSize); // Width
|
|
$bmpData .= pack('V', $totalSize); // Height
|
|
$bmpData .= pack('v', 1); // Planes
|
|
$bmpData .= pack('v', 24); // Bits per pixel
|
|
$bmpData .= pack('V', 0); // Compression
|
|
$bmpData .= pack('V', $totalSize * $totalSize * 3); // Image size
|
|
$bmpData .= pack('V', 2835); // X pixels per meter
|
|
$bmpData .= pack('V', 2835); // Y pixels per meter
|
|
$bmpData .= pack('V', 0); // Colors used
|
|
$bmpData .= pack('V', 0); // Important colors
|
|
|
|
// Pixel data (bottom-up, BGR format)
|
|
for ($y = $totalSize - 1; $y >= 0; $y--) {
|
|
for ($x = 0; $x < $totalSize; $x++) {
|
|
$rgb = imagecolorat($verify, $x, $y);
|
|
$colors = imagecolorsforindex($verify, $rgb);
|
|
$bmpData .= chr($colors['blue']);
|
|
$bmpData .= chr($colors['green']);
|
|
$bmpData .= chr($colors['red']);
|
|
}
|
|
// BMP rows must be padded to multiples of 4 bytes
|
|
$padding = (4 - (($totalSize * 3) % 4)) % 4;
|
|
$bmpData .= str_repeat("\0", $padding);
|
|
}
|
|
|
|
file_put_contents($bmpPath, $bmpData);
|
|
echo "✅ BMP created: qrcode-test.bmp\n";
|
|
echo " Size: " . filesize($bmpPath) . " bytes\n";
|