Displaying images from a directory...
Posted: Wed Apr 29, 2009 7:10 pm
First off I am using exec-php with Wordpress to execute PHP code in my "static" pages - I assume what I want to do it simple, but I am having issues.
What I want to do is just display all the files (JPGs) from a specified directory. I coded the following:
but... all this does is list the files names and right next to them it displays a broken icon as if the graphics are not there... what gives... can any one test this... and let me know their results... or is there another method to display graphics in this manner.
Thanks!
What I want to do is just display all the files (JPGs) from a specified directory. I coded the following:
Code: Select all
<?php
$dir = "./flash/portfolio/branding/images/";
//open dir
if ($opendir = opendir($dir))
{
//read dir
while (($file = readdir($opendir)) !== FALSE)
{
if ($file!="."&&$file!="..")
echo $file."<img src='$dir/$file'><br />";
}
}
?>Thanks!