从文件夹中查找第一张图片

I am using below code successfully to find the first image from a folder and display it. The problem I have is that the client has uploaded images with a mixture of uppercase and lowercase .jpg extensions on the images. Can i adjust my code to allow for both uppercase and lowercase .jpg extensions, as it only likes lower case?

$search_dir = "properties/".$row['Reference_No'];
    $images = glob("$search_dir/*.jpg");
    sort($images);

    // Image selection and display:

    //display first image
    if (count($images) > 0) { // make sure at least one image exists
        $img = $images[0]; // first image
        echo "<img src='../../$img' width='320' height='200' border='0' /> ";
    } else {
        // possibly display a placeholder image?
    }

You could merge your glob arrays

$images = array_merge(glob("$search_dir/*.jpg"),glob("$search_dir/*.JPG"));

As a side note; if you're handling the uploading of files, it might be an idea to strtolower() them when storing, this way you wont have issues and "untidiness"

Or

$images = glob("$search_dir/*.[jJ][pP][gG]");

But I do not understand well the concept of first image - sort() alphabetically !?