Here's the code I have started with:
Code: Select all
<?php
$dir = 'gallery/galleries/gallery1/';
$filecount = 0;
$d = dir($dir);
while ($f = $d->read()) {
if(($f!= ".") && ($f!= "..")) {
if(!is_dir($f)) $filecount++;
}
}
echo 'there are ',$filecount,' files in this folder';
?>So now what I want to do with that is put all those 29 filenames into an array.
Let's say the files in the gallery1 directory are named like this: 123.jpg, 456.jpg, 789.jpg etc.
Let's call my array "jpgarray"
If I were to echo my array this is what I would want it to echo:
jpgarray(0) = "123.jpg"
jpgarray(1) = "456.jpg"
jpgarray(2) = "789.jpg"
etc.
Could anyone point me in the right direction or give me some code snippets for this?