Skip to content

Instantly share code, notes, and snippets.

@mattbullen
Last active August 29, 2015 14:00
Show Gist options
  • Save mattbullen/11128025 to your computer and use it in GitHub Desktop.
Save mattbullen/11128025 to your computer and use it in GitHub Desktop.
A quick work-around to push a folder of image files from the server into an HTML list on a page.
<div id="image-wrapper">
<li id="image-list">
<?php
$counter = 0;
$directory = "images/";
$images = glob($directory . "*.png");
foreach($images as $image) { //Open bracket
?>
<a href="<? echo $image; ?>" id="image-href-"<? echo $counter; ?>">
<img src="<? echo $image; ?>" id="image-number-"<? echo $counter; ?>"/>
</a>
<?
$counter++;
} //Close bracket
?>
</li>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment