title: How to read and display images from local directory into a web page using php
body: <p>I want to display directory folders list on left side of web page and its contents on right side of the page only after clicking the related folder/file, how to achieve this?
  I worked on how to get the folder structure from local directory it is working good but i am unable to display the contents after clicking the related file.</p>
  
  <pre><code>&lt;ul&gt;
     &lt;li id="li1"&gt;
  &lt;a href=""&gt;
  &lt;?php
    $root = 'C:\Users\Public\Pictures';
    $pathLen = strlen($root);
    listFolderFiles($root, 0, strlen($root)); ?&gt;            
  &lt;/a&gt; 
     &lt;/li&gt;
   &lt;/ul&gt;
  
  &lt;div class="col-lg-8 col-md-8" style="border: 1px solid"&gt;
     &lt;img src="" width="100px" height="100px;"&gt;
  &lt;/div&gt;    
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>  &lt;?php 
      function listFolderFiles($dir){
      $ffs = scandir($dir);
  
      unset($ffs[array_search('.', $ffs, true)]);
      unset($ffs[array_search('..', $ffs, true)]);
  
      // prevent empty ordered elements
      if (count($ffs) &lt; 1)
          return;
  
      echo '&lt;ol&gt;';
      foreach($ffs as $ff){
          echo '&lt;li&gt;'.$ff;
          if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff);
          echo '&lt;/li&gt;';
      }
      echo '&lt;/ol&gt;';
      }
  
      ?&gt;
  </code></pre>