Just a little more magic thanks to PHP. Here is simple code to display all the images in a given directory using php. This script will loop through a given directory and show all the images in a folder.
This could very easily be modified to display a list of images or out put an entire gallery. The sky’s the limit once you can grab them!
<?php
$imgdir = 'path-to-images'; // the directory, where your images are stored
$allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show
$dimg = opendir($imgdir);
$i = 1;
while($imgfile = readdir($dimg))
{
if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
{
$a_img[] = $imgfile;
sort($a_img);
reset ($a_img);
}
}
$totimg = count($a_img); // total image number
for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);
// do whatever
$halfwidth = ceil($size[0]/2);
echo '<img src="Path'.$a_img[$x].'" alt="" /> ';
$i++;
}
?>
