views:

480

answers:

2

guys,

anyone know how to scan a folder using jquery or javascript code snippet, after that get a picture file name and embed in <li></li> or <div></div>, i've used php code to read through the folder and loop through the element to display the thumbnails and all, but it's not work well.

I've try on galleria, gallerific, galleryView jquery slideshow plugin but those might not work well with php processing because of predefined configuration or something, can anyone tweak or hack these gallery to dynamically read an image from a folder?

+2  A: 

There is a way to read local files using javascript, but it requires the user to set up his browser appropriately. I know about such feature in Firefox. In your case, the best way would be to use PHP for folder scan and Lightbox for image display (which in turn has slideshow plugins).

Evgesha
+1 for your last sentence (about PHP and Lightbox), but as for the rest of your answer, I think the OP is wanting to display images in a folder on the server, not on the client.
Blair McMillan
That's a good point, you're absolutely right. However, I don't know if there is any way to read remote directory with javascript/ajax (unless, of course, there is some kind of server-side web service: e.g. php-based, which returns json/xml).
Evgesha
No, there's not a good way to do that as you've said. I've just posted an answer with what I'd do (combine PHP to do the directory reading and output and then use JS to display the gallery/slideshow).
Blair McMillan
blair is correct, i want to read a file from server, currently i can do it with php script but when integrate with those gallery above its not work, later i will update the answer with what i've done, maybe i miss something
Nazmin
A: 

Perhaps you'd be better of saying what didn't work well when you tried the PHP path and we can help you fix that?

Your best bet is probably going to either be an existing thing such as Gallery as powtac mentioned, or if you are only wanting to display images from a single folder that might be a bit of overkill.

You could use PHP to output the thumbnails and whatever other information you need into a list of <li> tags, use CSS to hide some of them (if required) and then use Lightbox or any of the many other JS image galleries available to do what you want.

Then you can ask on here if you are having trouble with one of those steps (detailing what you are doing, what's going wrong etc).

Blair McMillan