Log in

View Full Version : Directory contents to array



Deived
12-28-2007, 07:44 PM
I'm kinda new to web development so I still have a lot to learn. Hopefully someone can help me out here.
I'm trying to create a personal family page where I can share pictures with friends and family. I can hand code the pages with all the images, but that would take too long to do whenever I want to add new images or album.
What I'm looking for is a way to use Javascript to pull in the contents of a directory (in this case it would be all images) into an array so that I can just have the HTML created dynamically using the contents of the array. Hopefully I'm asking the question right. Any help?

Twey
12-28-2007, 08:04 PM
You'd most likely need a server-side script to produce this array.

Deived
12-28-2007, 08:07 PM
Thanks. Actually, that makes more sense. I'm a little bit of a newb at Perl and Bash too but I can probably do it. Any leads?

jscheuer1
12-29-2007, 04:41 AM
PHP is the most popular method, and if it is available on your server, you could use this combination of PHP and javascript:

http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

There are many other possible approaches, some using only server side code, which would have the advantage of not requiring javascript on the user's end. But, any such gallery would be a little less elaborate.