Display all images in a specified directory

<?php $directory = "files/"; $images = glob($directory . "*.svg"); //change svg to any file type you want foreach($images as $image) { echo "<span class='helper'></span><li class='mix ".$image."'><img src='".$image."' alt='".$image."'></li>"; } ?>
There are a few things going on here. You'll notice I have a span before the <li> and that is so you can have each element aligned in the middle, if you wish to. I also have <li class='mix'> and then the file name also as a class. Using the file name as a class is useful when adding a search feature.
===
You can see an example of this at http://logos.struck.io

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.