Hi,
I found this script in the manual:
This file will list and link to all files of a specified type (image files
here!) within the directory the php file is in. I did it to simplify
putting pictures on the web to show people!
<head>
<META HTTP-EQUIV=\"expires\" CONTENT=\"Mon, 01 Jan 2001
01:00:00 GMT\">
<style>
a,body,td,p,br {font-family:verdana,arial,geneva; font-size:10pt}
</style>
</head>
<body>
<?
/
second thingo in $accepted_types can be:
y - show thumbnail
n - don't show anything
some_image - to show a generic image
/
$accepted_types = array( ".gif"=>"y",
".jpg"=>"y",
".mpg"=>"mov.gif" );
$images_per_row = 2;
if ( is_dir('./thumbnails') )
{
$thumbnails = true;
// some programs such as Graphic Workshop put a prefix on scaled images
$thumbnail_prefix = "S_";
// make sure you have the trailing /
$thumbnail_directory_name = "./thumbnails/";
}
$handle = opendir('.');
echo "
<i><b>Image Files:</b></i>
Click on the link to see the image
<hr>
";
// index value used together with $images_per_row
// to see if we should skip to the next row
$i = 0;
echo "<table border=0 cellpadding=2><tr>";
while ( ( $file = readdir($handle) )!== false )
{
// Don't show '.' and '..'
if ( $file != "." && $file != ".." )
{
$extension = strtolower(substr($file,strpos($file,".")));
// is this file type in the accepted types array?
if ( $accepted_types[$extension] )
{
$file_size = floor(filesize ($file) / 1024);
if ( $i>0 && is_integer($i/$images_per_row) )
$beginning = "\n</tr>\n<tr>\n";
else
$beginning = "";
echo "$beginning<td><a
href=$file>$file</td><td>$file_size
k</a></td>";
if ( $thumbnails && ($accepted_types[$extension]=='y') )
echo "<td><img
src=$thumbnail_directory_name$thumbnail_prefix$file></td>";
else if ( $thumbnails && ($accepted_types[$extension]=='n') )
echo "<td><font size=-2> </td>";
else if ( $thumbnails )
echo "<td><font size=-2><img
src=$thumbnail_directory_name$accepted_types[$extension]></td>";
$i++;
}
}
}
echo "</table>";
closedir($handle);
?>
</body>
It will list all files of a specific type and link to them.
Try looking in the online manual (http://www.php.net/manual/en) as well.
Elfyn