Here's a generic function that will search for an array of extensions, case-insensitive (well, not completely case-insensitive; files with mixed-case extensions won't be found):
function glob_ext_i($exts, $dir = './')
{
if (substr($dir, -1) != '/') {
$dir .= '/';
}
$glob_str = $dir . '*.{';
foreach ($exts as $ext) {
$glob_str .= strtolower($ext) . ',' . strtoupper($ext) . ',';
}
$glob_str = rtrim($glob_str, ',') . '}';
return glob($glob_str, GLOB_BRACE);
}
Example:
$Pics = '..';
$exts = array('JPG', 'png', 'jpeg', 'gif');
if ($glob = glob_ext_i($exts, $Pics)) {
foreach ($glob as $file) {
echo $file . '<br />';
}
}