At this stage I think you should go back to basics and confirm that the PHP is working for you. I've tested this code here and it works fine for me (in a page called "test.php");
Code:
<?php
function imageSlideArray($dir, $path) {
//$dir = '/home/www/mywebsite.com/images/';
//$path = 'Graphics/ShowPics/';
$patterns = '/\.(jpg|jpeg|png)$/'; // only these file types
if($hd = opendir($dir)){
while(false !== ($fname = readdir($hd))){
if(preg_match('/^\.{1,2}$/',$fname)) continue; // exclude current directory, parent directory
if(!preg_match($patterns,$fname)) continue; // exclude file types not in $patterns
$files_array[] = $fname;
}
}
sort($files_array); // sort files a-z
for ($i = 0; $i < count($files_array); $i++) {
$comma = ($i != count($files_array) - 1) ? ',' : ''; // if next item exists in array set $comma as ',' else '' (nothing)
echo "[\"$path$files_array[$i]\"]$comma<br/>";
}
closedir($hd);
}
?>
<?php imageSlideArray('/home/www/mywebsite.com/images/', 'Graphics/ShowPics/');?>
Prints out this;
Code:
["Graphics/ShowPics/about.jpg"],
["Graphics/ShowPics/bookmark.jpg"],
["Graphics/ShowPics/calendar.jpg"],
["Graphics/ShowPics/cross.jpg"],
["Graphics/ShowPics/demo.jpg"],
["Graphics/ShowPics/display.jpg"],
["Graphics/ShowPics/exclamation.jpg"],
["Graphics/ShowPics/extras.jpg"]
Bookmarks