Jump to content

Get all the images in a folder


mendoz

Recommended Posts

[quote author=mendoz link=topic=122099.msg503115#msg503115 date=1168612972]
Let's see who got what it takes  :-*
[/quote]

How about you?!?!?

Dror,

I've helped you out before and I find the task you're requesting now very easy.  Have you attempted it yourself yet?  If not then perhaps give it a go and then post what you came up with here when/if you get a problem.

Regards
Huggie
Link to comment
Share on other sites

If you know for sure they're the only ones in the folder, all you've got to do is loop through the directory with readdir(). If you need to check the extensions, you can easily add that to the following code:
[code]
<?php
//Open images directory
$images = "path/To/Files";
$dir = opendir($images);
$files = array();

while (($file = readdir($dir)) !== false) {
  // Account for directory structure references
  if ($file != '.' && $file != '..') {
    $files[] = $file;
  }
}

closedir($dir);

// Now $files holds the name of all your files
?>
[/code]

A simple google search would have come up with similar code.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.