| 
	
 | 
 Posted by Confused but working on it on 09/12/07 16:50 
Just wanted to say thanks for the posts helping me make ths work. Added  
a few comments and after the readdir used a pattern match to test for  
..jpg, and seems to work fine on my test setup. Maybe I should test for  
gif, tiff, and png... Anyway, here's the code: 
<?php 
//Open images directory 
$dir = opendir("images"); 
//read files in the dir 
while (($file = readdir($dir)) !== false) 
//test to make sure jpg 
if (eregi("\.jpg",$file)) 
	  { 
	      echo "<img src='images/$file' class=\"pad1em\">"; 
	   } 
closedir($dir); 
?> 
 
For my next trick I'm going to change the above to read a thumbs dir,  
and make a link to a larger picture of the same name in images.  
Shouldn't be too hard bt my last programming class was almost 20 years  
ago. :) Hats off to everyone that does this for a living. 
 
Thanks again!
 
  
Navigation:
[Reply to this message] 
 |