alconebay Posted November 8, 2008 Share Posted November 8, 2008 I currently am using $images = glob("" . $directory . "*.jpg"); to get the filename of all the jpg images in my directory. However, some of the images are .JPG instead of .jpg. How can I modify the code to get it to read both .jpg and .JPG files? Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted November 8, 2008 Share Posted November 8, 2008 Apparently there is no case-insensitive flag for glob() so what I would do is this: $images = array_merge(glob($directory . "*.jpg"), glob($directory . "*.JPG")); Quote Link to comment Share on other sites More sharing options...
alconebay Posted November 8, 2008 Author Share Posted November 8, 2008 That worked great. I just found an example (right before you replied) that also worked: $images = glob("$directory{*.jpg,*.JPG,*.png}", GLOB_BRACE); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.