title: Show only images inside specific folder with PHP
body: <p>I'm trying to show only images files from a specific folder with php and try so:</p>
  
  <pre><code>$dirname = "users/".trim($_GET['nome']);
      $files = array();
      if (is_dir($dirname)) {} else {mkdir($dirname, 0777);}
      $dir = opendir($dirname);
          //while ($file = readdir($dir)) {
          while ($file = readdir($dir)) {
              //if ($file == '.' || $file == '..') {
              if($file == '.' || $file == '..' || strpos($file,'jpg') == false){
                  continue;
              }
              $files[] = array('file' =&gt; 'http://www.lavorirapidi.it/public/users/'.trim($_GET['nome']).'/'.$file, 'name' =&gt; $file);
          }
      echo json_encode($files);
  </code></pre>
  
  <p>But I notice that I view only jpg small case! If I remove </p>
  
  <pre><code>|| strpos($file,'jpg') == false
  </code></pre>
  
  <p>I view also subdirectory!
  My question is: is it possible view only jpg, png, gif not case sensitive?</p>