$units) { $barW = max(1, round($units * $unitWidth)); // minimum 1px if ($i % 2 === 0) { imagefilledrectangle($img, (int)$x, $topMargin, (int)($x + $barW - 1), $topMargin + $barHeight - 1, $black); } $x += $barW; } $outputPath = __DIR__ . '/images/door_code.png'; imagepng($img, $outputPath, 0); // no compression for sharp lines imagedestroy($img); echo "✅ Ultra-complex door code generated: images/door_code.png (" . filesize($outputPath) . " bytes)\n"; echo "Pattern elements: " . count($pattern) . " (31 bars + 30 gaps)\n"; echo "Total units: $totalUnits, Unit width: " . round($unitWidth, 2) . "px\n"; echo "Very thin bars (1-unit) = " . round($unitWidth, 1) . "px — will degrade on photo\n"; echo "

";