/* If your image bin is not named "images", change the name below.
*/
$dir_name = "images";
$dir = opendir($dir_name);
// start the table:
$file_list = "";
while ($file_name = readdir($dir)) {
// skip documents:
if (($file_name != ".") && ($file_name != "..")
&& (!preg_match("/.htm/i", "$file_name"))
&& (!preg_match("/.php/i", "$file_name")))
{
$file_list .= "
- name: $file_name
";
$image_file = "$dir_name/$file_name";
$image_size = getimagesize($image_file, &$image_info);
while(list($key, $value) = each($image_size))
{
// make the output easier to read
switch($key){
case 0: $key = " - width: "; break;
case 1: $key = " - height: "; break;
case 2: $key = " - type: "; break;
case 3: $key = " - string:
"; break;
case bits: $key = "bits per sample:"; break;
}
if ($key == "type"){
switch($value){
case 1: $value = "GIF image"; break;
case 2: $value = "jpeg image"; break;
case 3: $value = "PNG image"; break;
}
}
$file_list .= ($key . $value . "
\n");
}
// close that part of the table and make the next one for the image
$file_list .= "
";
}
}
// finish the table
$file_list .= "
";
closedir($dir);
?>
List of images
The images in " echo "$dir_name"; ?>"
echo "$file_list"; ?>