";
while ($g <= $anz_images) {
for ($i = 1; $i<=4; $i++) {
echo "
";
for ($j = $l; $j <= $n; $j++) { // Anzahl pro Spalte
if ($g <= $anz_images){ ?>

"
alt="hbc fotos" style="width:100%;"> ";
$l = $n; // weitere 4 Bilder pro Spalte
$n = $n+$anz; // nächste Spalte mit n Bildern
}
}
echo "