Added case insensitivity to check for image extensions