Posted By

garretjames on 11/05/09


Tagged

php directory


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

xmartyxcorex


Image names in directory


 / Published in: PHP
 

  1. <?php
  2. if ($handle = opendir('Images/Slideshow')) {
  3.  
  4. while (false !== ($file = readdir($handle)))
  5. {
  6. if ( preg_match( "/[.]jpg$/", $file ) ) {
  7. preg_match( "/_(\d+)_(\d+)[.]/", $file, $found );
  8. ?>
  9. <div class="imageElement">
  10. <h3></h3>
  11. <p></p>
  12. <a href="#" title="open image" class="open"></a>
  13. <img src="Images/Slideshow/<?php echo $file; ?>" class="full" /></div>
  14. <?php
  15. }
  16. }
  17. closedir($handle);
  18. }
  19. ?>

Report this snippet  

You need to login to post a comment.