Hi,
My relatively simple photo album browses the specified directory and (if found) will get the size of every image. A list of thumbnails is shown that, when an image is clicked, will do appear a popup screen with the exact size of the particular image.<br><br>
The last image put in the directory is also shown as the last image in the HTML file. How can I reverse the order in which the images appear. I would like to display the last added image as first. Here is a little code snippet I use:
<br><br>
<pre>
echo "<table cellpadding=5 cellspacing=5 bgcolor=FDFBDA width=100% border=0><font size=2>";
/ Count table cells (to add <tr>) /
$tablecells=0;
$dir = 'images/album';
/ Open directory for reading /
$dir_handle = @ opendir ($dir)
or die ("Can't read $dir directory");
/ Process all entries in dir /
while ($file = readdir ($dir_handle))
{
/ Extensie jpg, jpeg, gif of png /
if (eregi ('.(jpg|jpeg|gif|png)$', $file))
{
/ Find image size /
if ($size = getImageSize ("$dir/$file"))
{
/ Link to image /
if ($telcellen==0)
{
echo "<tr>";
}
/ HTML part to display thumbnails with link to bigger picture /
$href = '<a
href="javascript:popUp(\'display.php?img=%s\', %d, %d, 100, 100)">%s</a><br>';
$token=strtok($file,".");
$image="<img src=/images/album/thumbs/tn_$file width=80 height=60 border=0>";
$href2 = '<a
href="javascript:popUp(\'display.php?img=%s\', %d, %d, 100, 100)">%s</a><br>';
echo "<td>";
printf ($href2, "$dir/$file", $size[0],
$size[1],$image);
printf ($href, "$dir/$file", $size[0],
$size[1], $token);
echo "</td>";
$tablecells++;
if ($tablecells==6)
{
echo "</tr>";
$tablecells=0;
}
}
}
}
closedir($dir_handle);
</pre>
Thanks in advance for all your help!
Matt