Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Get list of images in given directory
- */
- function get_image_list($dir) {
- $files = array();
- $h = opendir($dir);
- while ( false !== ( $file = readdir($h) ) ) {
- // if file isn't this directory or its parent
- if ($file != '.'
- && $file != '..'
- && !is_dir($dir.'/'.$file)
- && preg_match('@(gif|png|jpg|jpeg)$@i', $file) ) {
- $files[] = $file;
- }
- }
- closedir($h);
- return $files;
- }
Advertisement
Add Comment
Please, Sign In to add comment