Page 1 of 1

Excluding hidden files

Posted: Fri Aug 22, 2008 5:07 pm
by neridaj
Hello,

I'm having problems figuring out how to exclude hidden files when building an image array. I'm using a regex to validate the image, should I use another regex for hidden files instead of strtok()?

Code: Select all

 
function get_after_thumbs()
{
    $dir = get_dir();
    $afterdir = $dir . 'after/thumbs/';
    $files = scandir($afterdir);
    foreach($files as $value) {
        // check for image files
        if(valid_image_file($value))
            if(!strtok($value, '._'))
            // build image array
            $imgarr[] = $value;
    }
    $count = count($imgarr);
    for ($i=0; $i<$count; $i++) {
        echo '<img class="floatright" src="' . $dir . 'after/thumbs/' . $imgarr[$i] . '" width="25" height="25" alt="09 285" />';
    }
    var_dump($imgarr);
}
 
Thanks,

Jason