Posted By

twoeight on 10/25/11


Tagged

php gallery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Net-Freak


Gallery from folder whit php


 / Published in: PHP
 

  1. <?php
  2. $thumb = "thumb"; //thumb folder name whit no "/"
  3. $images = "img"; //images folder name whit no "/"
  4.  
  5.  
  6. $listOfFilesToSort = array();
  7. $folder = opendir($images);
  8. while ( false !== ( $file = readdir( $folder ))){
  9. if ( $file != "." && $file != ".." )
  10. $listOfFilesToSort[$file] = $file;
  11. }
  12. sort( $listOfFilesToSort );
  13. foreach ( $listOfFilesToSort as $file )
  14. {
  15. echo '<a href="'.$images.'/'.$file.'"><img src="'.$thumb.'/'.$file.'" class="gal"></a>';
  16. }
  17. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Steffen82 on November 3, 2012

A nice OOP-PHP5-Class for crating Thumbnails: https://github.com/SteffenHagdorn/Pixlie

You need to login to post a comment.