Page 1 of 1

Displaying images from a directory...

Posted: Wed Apr 29, 2009 7:10 pm
by jderosa3
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:

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 />";
   }
}
?>
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!

Re: Displaying images from a directory...

Posted: Wed Apr 29, 2009 8:15 pm
by McInfo
What is the full path to your script, and what is the full path to your images folder?

Edit: This post was recovered from search engine cache.