Guest User

fileWithFunction.php

a guest
May 24th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.    
  3.  
  4.     function getAllImagesInDirectory($path) {
  5.     if ($handle = opendir($path)) {
  6.         $images = "[";
  7.         while (false !== ($file = readdir($handle))) {
  8.             if($file !== "." && $file !== "..") {
  9.                 $images .= "{image : '$path$file', title : '', url : ''},";
  10.             }
  11.         }
  12.         closedir($handle);
  13.         return substr($images,0,strlen($images)-1) . "]";
  14.     }
  15.  
  16.     }
  17.  
  18.  
  19. $output = getAllImagesInDirectory("C:\Users\jbstrand\Downloads");
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment