getSize(); // Verify format info $formatCols = [0, 1, 2, 3, 4, 5, 7, 8, 20, 19, 18, 17, 16, 15, 14]; $formatH = ''; foreach ($formatCols as $col) { $formatH .= $matrix->getModuleAt(8, $col)->isDark() ? '1' : '0'; } echo "Format Info: $formatH\n"; echo "Expected: 101010000010010 (Python)\n"; echo "Match: " . ($formatH === '101010000010010' ? "✅" : "❌") . "\n\n"; // Generate PNG $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); imagefill($image, 0, 0, $white); 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; 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-mask0.png'; imagepng($image, $filepath, 0); echo "✅ Generated: qrcode-mask0.png\n"; echo " Size: {$totalSize}x{$totalSize}px\n"; echo " Mask Pattern: 0 (same as Python)\n"; echo "\nPlease test this QR code!\n";