How can i list images in a folder…(which could be any number) and echo them in a list making the sure the first li has a class of “first” and the the last list item has a class of “last” like so…
<li class="first"><img src="flowing-rock.jpg" /></li>
<li><img src="stones.jpg" alt="Stones" /></li>
<li><img src="grass-blades.jpg" /></li>
<li><img src="ladybug.jpg" alt="Ladybug" /></li>
<li class="last"><img src="pier.jpg" alt="Pier" /></li>
Any help would be appreciated…
The following will select the first and last (if they exist), printing them before and after the rest, respectively. These are sorted alphabetically by
scandir().