Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // open this directory
- $myDirectory = opendir("ss");
- // get each entry
- while($entryName = readdir($myDirectory)) {
- $dirArray[] = $entryName;
- }
- // close directory
- closedir($myDirectory);
- // count elements in array
- $indexCount = count($dirArray);
- ?>
- <ul>
- <?php
- // loop through the array of files and print them all in a list
- for($index=0; $index < $indexCount; $index++) {
- $extension = substr($dirArray[$index], -3);
- for($i=0; $i<count($images) && $i<4; $i++) {
- // Use $images[$i]
- }
- if ($extension == 'jpg'){ // list only jpgs
- echo '<li><img class="img" src="ss/' . $dirArray[$index] . '" alt="Image" /><span>' . $dirArray[$index] . '</span>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement