We have 28 guests online
   
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Make an easy list of your photos by MBK
User Rating: / 14
PoorBest 

Just put this script somewhere and edit the $path variable to the path where the photos/images are you want to list. It searches the dir for files with the extension jpg, gif and bmp. You can add more if you want.
Then it sorts them, and lists them.

  1. <?
  2. $path = "/the/path/with/your/photos/" ;
  3. $d = dir("$path");
  4. $count = 0;
  5. while($entry=$d->read()) {
  6.   $file = explode(".", "$entry");
  7.   $extens = end($file);
  8.   $extens = strtolower ($extens);
  9.  
  10.   if ($extens == "jpg" OR $extens == "gif" OR $extens == "bmp") {
  11.     $file[$count] = $entry;
  12.     $count++;
  13.   }
  14. }
  15. sort($file);
  16. reset($file);
  17. for ($i = 0; $i < $count; $i++) {
  18.   echo "<a href='$path/$file[$i]'>$file[$i]</a><br>";
  19. }
  20. ?>

 

 

Directory Stats

There are 882 listing and 46 categories in our website

Change Language