Posted By

LukeLux on 09/23/10


Tagged

php textmate images


Versions (?)

PHP - Images link to pages


 / Published in: Other
 

  1. <?php
  2. $dir = 'images/thumbs/';
  3. $path = 'portfolio/print/';
  4.  
  5. $fileTypes = array( '.png', '.jpg', '.gif');
  6.  
  7. foreach( $fileTypes as $extension ) {
  8. foreach( glob($dir . '*' . $extension) as $projectImage ) {
  9. $projectName = basename($projectImage, $extension);
  10. $project = $projectName . '.php';
  11. echo '<li>
  12. <a href="'. $path . $project . '">
  13. <img src="' . $projectImage . '" alt="' . $projectName . '" />
  14. <strong>'. $projectName .'</strong>
  15. </a>
  16. </li>';
  17. }
  18. }
  19. ?>

Report this snippet  

You need to login to post a comment.