Thank musicman but I think something is wrong as it is now not outputting any images.
PHP Code:
<?php
$images = "advertisingExamples/thumbs/"; # Location of small versions
$big = "../../advertisingExamples/big/"; # Location of big versions (assumed to be a subdir of above)
if ($handle = opendir($images)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != rtrim($big,"/")) {
$files[] = filemtime("$images/$file");
}
}
closedir($handle);
}
arsort($files);
$i = 0;
foreach($files as $file => $mtime)
{
echo '<td align="center"><a href="' . $images . $big . $file . '"><img src="' . $images . $file . '" /></a></td>';
if (++$i == 3) break;
}
?>
Edit - It's outputting the following on the web page.
Code:
<td align="center">
<a href="advertisingExamples/thumbs/../../advertisingExamples/big/5">
<img src="advertisingExamples/thumbs/5" /></a></td><td align="center">
<a href="advertisingExamples/thumbs/../../advertisingExamples/big/4">
<img src="advertisingExamples/thumbs/4" /></a></td><td align="center">
<a href="advertisingExamples/thumbs/../../advertisingExamples/big/3">
<img src="advertisingExamples/thumbs/3" /></a>
</td>
For some reason the filenames are numbers (5, 4 and 3). Also the folders are wrong. It should output:
Code:
<td align="center">
<a href="advertisingExamples/advertisingExamples/big/newest.jpg">
<img src="advertisingExamples/thumbs/newest.jpg" /></a></td><td align="center">
<a href="advertisingExamples/advertisingExamples/big/2ndnew.jpg">
<img src="advertisingExamples/thumbs/2ndnew.jpg" /></a></td><td align="center">
<a href="advertisingExamples/advertisingExamples/big/oldest.jpg">
<img src="advertisingExamples/thumbs/oldest.jpg" /></a></td>