I have this code that gets all the files from the directory i want. I would like to validate that i read only the images in the directory and not all the files.
$documents = [];
        $filesInFolder = \File::files('/var/www/test/storage/app/public/random_images');
        foreach ($filesInFolder as $path) {
            $documents[] = pathinfo($path);
        }
        return View::make('documents.index')->with('documents', $documents);
The pathinfo gets an array of
    array:8 [▼
  0 => array:4 [▼
    "dirname" => "/var/www/test/storage/app/public/random_images"
    "basename" => "sjsdfoltroigj.jpg"
    "extension" => "jpg"
    "filename" => "sjsdfoltroigj"
  ]
  1 => array:4 [▼
    "dirname" => "/var/www/test/storage/app/public/random_images"
    "basename" => "local-economy4pdf-pasay-city.jpg"
    "extension" => "jpg"
    "filename" => "local-economy4pdf-pasay-city"
  ]
How do i add a loop that checks all the extension in the array?