Anyone know how I can have a simple page that'll display every single image in a certain directory.
for example...
www.mysite.com/images.php
would display every single image in
www.mysite.com/images
Nothing fancy, as long as it does the job that's fine
EDIT: Scrap that, this does the trick:
PHP Code:<?php
// Note that !== did not exist until 4.0.0-RC2
if ($handle = opendir('/path/to/image/directory')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo "<img src='http://www.mysite.com/images/";
echo "$file\n";
echo "'><br />";
}
/* This is the WRONG way to loop over the directory. */
while ($file = readdir($handle)) {
echo "$file\n";
}
closedir($handle);
}
?>






Reply With Quote





