Skip to content

Instantly share code, notes, and snippets.

@dewski
Created August 13, 2009 20:50
Show Gist options
  • Select an option

  • Save dewski/167444 to your computer and use it in GitHub Desktop.

Select an option

Save dewski/167444 to your computer and use it in GitHub Desktop.
<?php
$imglist = array();
//$img_folder is the variable that holds the path to the banner images. Mine is images/tutorials/
// see that you don't forget about the "/" at the end
mt_srand((double)microtime()*1000);
//use the directory class
$imgs = dir('./');
//read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file)) {
$imglist[] = $file;
}
} closedir($imgs->handle);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment