Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if (filter_input(INPUT_GET, 'var')) {
  5. $search_url = filter_input(INPUT_GET, 'var');
  6. } else {
  7. $search_url = filter_input(INPUT_POST, 'id');
  8. }
  9.  
  10.  
  11. if (strlen($search_url) < 1) {
  12. $search_url = 'photos/przedszkolaki';
  13.  
  14. }
  15.  
  16. $dirFiles = array();
  17. if ($handle = opendir($search_url)) {
  18. while (false !== ($file = readdir($handle))) {
  19.  
  20. $crap = array(
  21. ".jpg",
  22. ".jpeg",
  23. ".JPG",
  24. ".JPEG",
  25. ".png",
  26. ".png",
  27. ".gif",
  28. ".GIF",
  29. ".bmp",
  30. ".BMP",
  31. "_",
  32. "-"
  33. );
  34.  
  35. $newstring = str_replace($crap, " ", $file);
  36.  
  37.  
  38.  
  39. if ($file != "." && $file != ".." && $file != "Thumbs.db") {
  40. $dirFiles[] = $file;
  41. }
  42. }
  43. closedir($handle);
  44. }
  45. sort($dirFiles);
  46.  
  47. foreach ($dirFiles as $file) {
  48. echo '<figure>';
  49. echo '<img src=" ' . $search_url . '/' . $file . '" class="img-rounded " >';
  50. echo '</figure>';
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement