Hi,
Im trying to create a function that will list all the images in a directory. I think i have already done this but for some reason im not allowed to go into a folder. here is the error im getting:
Warning: opendir(.../mailfuse/templates/Test/TestTest/): failed to open dir: No such file or directory in /home/ziggy/public_html/functions.php on line 125
Warning: readdir(): supplied argument is not a valid Directory resource in /home/ziggy/public_html/functions.php on line 132
here is the actual code that calls this:
$images = findImages("../mailfuse/templates/Test/TestTest/");
here is the code:
function findImages($directory)
{
$handle = opendir(".".$directory);
$images = array (
"gif" => array(0 => "gif"),
"jpg" => array(0 => "jpg")
);
while($file = readdir($handle))
{
if(substr(strtolower($file),-4) == ".gif")
{
$images["gif"][] = $file;
}
else if(substr(strtolower($file),-4) == ".jpg")
{
$images["jpg"][] = $file;
}
}
return $images;
closedir($handle);
}
any help would be much appreciated!