/ Published in: PHP
URL: http://www.liamdelahunty.com/tips/php_list_a_directory.php
To make an image browser, add these lines:
$ext = strtolower(substr("$dirArray[$index]", strrpos("$dirArray[$index]", '.') + 1)); //get file extensions
if ("$ext" == "jpg") { // if file is a jpg
print("$dirArray[$index]<br/>"); // show image and create link to it
Expand |
Embed | Plain Text
// open this directory // get each entry $dirArray[] = $entryName; } // close directory // count elements in array // sort 'em // print 'em // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { } }
You need to login to post a comment.
