Perhaps this is a start...
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
return (preg_match('#^https?\:\/\/[a-z0-9-]+.([a-z0-9-]+.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
// EDIT: $num_images changed from 6 to 12
$num_images = 12;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
ORDER BY image_date DESC
LIMIT $num_images";
$result = $site_db->query($sql);
// EDIT: $count used as a counting variable to keep track
// of how many pictures to display in a row
$count = 0;
echo '<table align="center"><tr>';
while ($row = $site_db->fetch_array($result)){
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo '<td align="center">';
echo "<center><a href=\"/povezava"><img src="".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br></center>\n";
// EDIT: changed the order of HTML <b> and <center> tags
echo "<b><center>$image_name<br></center></b>\n";
echo "<center>Komentarjev: $image_comments</center>\n";
echo '</td>';
// EDIT: Add a new row after 6 pictures
if ($count == 6)
echo '</tr><tr>';
$count++;
}
echo '</tr></table>'
?>
if you wanted three rows of four, you could change the if statement to
if (($count == 4) || ($count == 8))
echo '</tr><tr>';
It should be very simple to modify it however you want.
HTH