title: Random image of day (PHP)
body: <p>I'm trying to add a simple random image of the day script. It doesn't point to the right file location though. Here is the code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php 
   $i=0; 
   $path="images";  
   $ext = "jpg";  
   $extra= "alt=\"Random Image\" float=\"left\""; 
   if ($handle = opendir($path)) {  
      while (false !== ($file = readdir($handle))) {  
      if (substr($file,strlen($file)-3,3)==$ext)  
  {        $imgs[$i++]=$file; 
  } 
      } 
     closedir($handle);  
    $today=getdate(); 
  
  srand($today['mday']+$today['month']+$today['year']);  
  
     $r=rand(0,$i-1); 
  
     echo("&lt;img src=images/\"$imgs[$r]\" $extra&gt;"); 
  
   }
  
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The image source when I right click and check properties is adding %22 before and after the file. EX: mobile/images/%22image.jpg%22</p>
  
  <p>Therefore, the image isn't showing because of it I presume.</p>