[PHP] ### Image Display Problem ### From: Theodore Jones (theoj <email protected>)
Date: 09/25/00

Hello,

I'm new to this list, so forigive a probably basic problem I present
here:

I'm trying to just iterate through a series of sub-directories of a main
directory. In each subdirectory there are just a set of image files.
All I would like to do is open each sub-directory, read the first image
name from that directory, and display that image, then go to the next
directory. For some reason I cannot get past a certain stage of just
throwing out all image-names per directory. Here is what I'm working
with so far:

<?
  $path = '/home/sites/site10/web/members/gallery/thumbs_new';
  $dir_handle =  <email protected>($path) or die("Unable to open $path");
  while ($file = readdir($dir_handle)) {
   if ($file == "." or $file == "..") {
    // do nothing
   } else {
    $thumb_dir = '/home/sites/site10/web/ft_members/video/thumbs_new/' .
$file;
    $directory =  <email protected>($thumb_dir) or die("Unable to open
$thumb_dir");
    while ($file = readdir($directory)) {
     if ($file == "." or $file == "..") {
      // do nothing
     } else{
      echo "$file <BR>";
     }
    }
    closedir($directory);
    echo "<P>";
   }
  }
  closedir($dir_handle);
  ?>

I think I need to create an array of the images as I iterate through
each sub-directory so that I can just display one image per directory,
but I'm at a loss as to where to nest this in and how?

Any comments?

~ Theo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>