Posted By

pruntrut on 02/05/12


Tagged

php images


Versions (?)

Loop dans repertoire


 / Published in: PHP
 

  1. $dir = 'images';
  2. $dirname = $dir;
  3.  
  4.  
  5. if ( $dir = opendir($dirname)) {
  6. while (false !== ($file = readdir($dir))) {
  7. if ($file != "." && $file != ".." ) {
  8.  
  9. $tableau[] = $file;
  10. // variable qui compte le nombre de fichiers dans le dossier
  11. $nbr = count($tableau);
  12. }
  13. }
  14. closedir($dir);
  15.  
  16. for ($i = 0 ; $i < $nbr ; $i++)
  17.  
  18. {
  19.  
  20. echo' <img src="'.$dirname.'/'.$tableau[$i].'" class="full" alt="&nbsp;" width="520" />';
  21.  
  22. }
  23. }

Report this snippet  

You need to login to post a comment.