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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sebnewyork
Forum Commoner
Posts: 43
Joined: Wed Mar 17, 2004 10:20 pm

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

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

glob() and it's brothers would help finding/building such a list..
sebnewyork
Forum Commoner
Posts: 43
Joined: Wed Mar 17, 2004 10:20 pm

Post by sebnewyork »

??
what does that mean?...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

glob returns an array of filenames matching the $pattern parameter.
sebnewyork
Forum Commoner
Posts: 43
Joined: Wed Mar 17, 2004 10:20 pm

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply