|
-
How to read a folder on the server?
I'd like to make a dynamic photo gallery that bypasses XML; so the website owner can just upload folders/images to a directory, and not bother updating an xml file.
I think PHP could be one way to do this, is it the best? Could Flash do it without a serverside script, just AS?
Basically, I would like the script (AS, PHP, whatever) to look in a directory, let's call it "gallery/". Any folders in that directory become categories in the gallery (drop-down or combo box or something is populated with the folder/category names). Any images in those folders are automatically made into thumbnails, and displayed when that category is selected. Can be a manual gallery, a slideshow, or whatever. I'll work on that later.
Is PHP my best answer?
Thanks!
-
Registered User
hi,
PHP is a good solution.
A simple script such as
PHP Code:
<?php
//path to directory
$directory = './images/';
//get all image files with a .jpg, .jpeg, .png or .gif extension
$images = glob("$directory{*.gif,*.jpg,*.jpeg,*.png}", GLOB_BRACE);
// view the array with the images' names
print_r($images);
?>
does what you want.
After having the images in an array, you can still generate an xml file dynamically.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|