hi there ppl, my gallery script is working just fine, but now i need something more..
take a look at it
http://www.xgn.com.br/galeria.php?dir=/photo/pictures/Codename%20Panzers%20Phase%20two/03_02_2005/
But some games have a loot of screenshots and i dont wanna mess them out.. and i wanted to make just onde gallery for each game...
So far i have this:
<?php
function ls ($curpath,$subdir) {
$dir = dir($curpath . "/" . $subdir);
// echo("<b>$curpath</b>");
//echo "<blockquote>";
while ($file = $dir->read()) {
if($file != "." && $file != "..") {
if (is_dir($curpath.$file)) {
ls($curpath.$file."/");
} else {
// echo("$file<br>");
$file_array[] = $file;
}
}
}
$dir->close();
// echo "</blockquote>";
return $file_array;
}
$startpath = "/home/xgncom/public_html/";
$subdir = $_GET[dir];
$rows = array();
$rows = ls($startpath,$subdir);
$rows_count = count($rows);
$count = 0;
echo '<table align="center" border="0" cellpadding="0" cellspacing="6">';
for ($i = 0; $i <= $rows_count; $i++) {
// echo $rows[$i];
$ext = substr($rows[$i], -3);
if($ext == "jpg" or $ext == "gif" or $ext == "JPG" or $ext == "GIF"){
$count++; }
if($count == 1) {
echo '<tr >';
}
else if($count <= 5) {
if($ext == "jpg" or $ext == "gif" or $ext == "JPG" or $ext == "GIF") {
echo '<td><a href="' . $subdir . '/' . $rows[$i] . '" target="_blank"><img border="0" src="' . $subdir . '/' . '_thm/thm_' . $rows[$i] . '"></a></td>';
}
}
else {
echo '</tr>';
$count = 1;
}
}
echo '</table>';
?>
But now i need to organize the gallery, i want the last modified files to be shown first, descenting from the modified date..
Is there a simple way to do this?
Thanx for any help 🙂