directory showing thumbnails

Discussion in 'Programming' started by caligrafx, Jan 28, 2010.

  1. #1
    I was just wondering if someone could tell me how to get images in a ftp directory to show thumbnails?

    Thanks,
    Adam
     
    caligrafx, Jan 28, 2010 IP
  2. Bween

    Bween Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Should be something close to:

    
    <?php
    
    //define the path as relative
    $path = "/home/yoursite/public_html/whatever";
    
    //using the opendir function
    $dir_handle = @opendir($path) or die("Unable to open $path");
    
    echo "Directory Listing of $path<br/>";
    
    
    while ($file = readdir($dir_handle)) 
    {
       if($file!="." && $file!="..")
          echo "<a href='$file'>$file</a><br/>";
    }
    
    
    //closing the directory
    closedir($dir_handle);
    
    ?>
    
    PHP:
    Just convert that while loop to an image rather than a link.
     
    Bween, Feb 3, 2010 IP
  3. Bween

    Bween Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh, and make sure your thumbs directory is readable.
     
    Bween, Feb 3, 2010 IP