Page 1 of 1

dynamic list that detects the number of items in a folder?

Posted: Sun May 16, 2004 12:51 pm
by sebnewyork
Hi all
I want to build a dynamic image gallery.
I'm looking for a php script that will display a list of numbers, like:
1 2 3 4 5 6
this list must dynamically reflect the number of items (6) in a certain folder, number that will vary in time. These items will be jpegs. And each number should be a link to load the respective jpeg in a frame.

Basically, no matter how many images, the list of links that dynamically load each image will go see how many images there are in the image folder and link each number in the list to an image.

Any help, script examples or suggestions on how to proceed would be greatly appreciated.
Thanx in advance

Posted: Sun May 16, 2004 12:55 pm
by feyd
glob() and it's brothers would help finding/building such a list..

Posted: Sun May 16, 2004 1:24 pm
by sebnewyork
??
what does that mean?...

Posted: Sun May 16, 2004 1:44 pm
by feyd
glob returns an array of filenames matching the $pattern parameter.

Posted: Sun May 16, 2004 3:27 pm
by sebnewyork
may be i should have mentioned that all i've done with php so far is a submit form...
what is glob?
a php function?
I don't know what the $pattern parameter is either.
You would help me if you told me a little bit more about it and put things in context.
I don't expect the whole code to fall from the sky, but i thought the idea of such a dynamic gallery would have already been applied in many circumstances and that there would be concrete examples or tutorials on how to do that?

Posted: Sun May 16, 2004 3:49 pm
by feyd
in my first post, glob() is a link to the php manual page for glob.

Yes, it is a php function. $pattern is the first parameter for it.

usage like:
glob("/path/to/image/folder/*.jpg")
will return an array (if the folder exists) of file names which match *.jpg.. or all .jpg files in that directory. The returned data is full path locations of the files, you can use this information to help build the links you'll use for your display.

For examples, I believe there's one in the code snippets forum, as well, there are scripts on hotscripts.com for this as well.