read a folder anf display images and diplay
Posted: Tue Apr 28, 2009 8:08 am
Hello All!
I am close to getting this script to work but have hit a roadblock. I am trying to get the images from a folder to be stored in separate variables - something like a mysql_fetch_array for images in a folder.
This is what I have now:
It displays all of the images but I cannot figure out how to get each image into a separate variable to be called into an <li> as an img src.
Thanx a million!
I am close to getting this script to work but have hit a roadblock. I am trying to get the images from a folder to be stored in separate variables - something like a mysql_fetch_array for images in a folder.
This is what I have now:
Code: Select all
<?php
$path = "img/images/co_images/playfulpromises/small/";
$dirname = "img/images/co_images/playfulpromises/small/";
$images = scandir($dirname);
foreach($images as $file)
{
if ($file != "." && $file != "..")
{
$files[] = $file;
}
$size_array = count($file);
$i=0;
while($i<$size_array)
{
?>
<img src="<?php echo $path ?><?php echo $file ?>" /><br /><br />
<?php
$i++;
}
}
?>
Thanx a million!