config['(site_url)'].'assets/files/'.$Location.'/'; // set path to files $dir_array = array(); // main array - contains all file names in directory // open directory and parse file list if (is_dir($dir)) { if ($dh = opendir($dir)) { // iterate over file list to create full directory array while (($filename = readdir($dh)) !== false) { if (($filename != ".") && ($filename != "..") && ($filename !="WS_FTP.LOG") && (!preg_match('/^.thumb_/', $filename))) { // skip self, parent, and ftp log and thumb prefix if returning images $dir_array[] = $filename; // add the filename to the array } } closedir($dh); // close directory } $docSort($dir_array,SORT_STRING); // sorting. $n = count($dir_array); // total number of files -- might want this for something $output = ''; $output .= '