47,15 → 47,57 |
write('<table>'); |
write('<tr>'); |
|
$i = 0; |
$directory = "albums" . $dirName . "/"; |
$sortOrder = "newestFirst"; |
|
$dir = dir('albums/' . $dirName); |
while (($file = $dir->read()) !== false) |
$results = array(); |
$handler = opendir($directory); |
|
while ($file = readdir($handler)) |
{ |
if (getimagesize('albums/' . $dirName . '/' . $file)) |
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file)) |
{ |
if ($file[0] != '.') |
$currentModified = filectime($directory . $file); |
$file_names[] = $file; |
$file_dates[] = $currentModified; |
} |
} |
|
closedir($handler); |
|
if ($sortOrder == "newestFirst") |
{ |
arsort($file_dates); |
} |
else |
{ |
asort($file_dates); |
} |
|
$file_names_Array = array_keys($file_dates); |
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name]; |
$file_dates = array_merge($file_dates); |
|
$i = 0; |
|
/* //Loop through dates array and then echo the list |
foreach ($file_dates as $$file_dates){ |
$date = $file_dates; |
$j = $file_names_Array[$i]; |
$file = $file_names[$j]; |
$i++; |
|
echo "File name: $file - Date Added: $date. <br/>"; |
}*/ |
|
$indexInArray = 0; |
$i = 0; |
|
foreach ($file_dates as $$file_dates) |
{ |
$j = $file_names_Array[$indexInArray]; |
$file = $file_names[$j]; |
|
if ($i >= 3) |
{ |
write('</tr><tr>'); |
68,9 → 110,8 |
write('<td><a href="' . $filename . '"><img width="' . $size[0] . '" height="' . $size[1] . '" src="' . $filename . '" /></a></td>'); |
|
$i++; |
$indexInArray++; |
} |
} |
} |
|
write('</tr>'); |
write('<table>'); |