title: How to change menu to match image color with PHP
body: <p>Let's say I have five images:</p>
  
  <p>red, green, blue, purple and orange.jpg</p>
  
  <p>How can I make these change randomly on refresh and make the navigation menu color change based on the image?</p>
  
  <p>I did try but the code I wrote is so laughable that I'd never put it up for anyone to see.</p>
  
  <p>Edit: keep in mind this is taken from another forum and edited for what I tried to do. This was made for testing. Also, inside the maintenance folder where I'm getting my files there is a .jpg image called storage. That's why you see it in the code.</p>
  
  <pre><code>    &lt;?php 
  //path to the image directory 
  $directory = "maintenance/"; 
  
  //get all image files with a .jpg extension. 
  $images = glob("" . $directory . "*.jpg"); 
  
  // get random image index 
  $rand_img = array_rand($images, 1); 
  
  // display the image 
  echo '&lt;img src="'.$images[$rand_img].'" alt="" /&gt;';
   ?&gt;
  
  &lt;div style="&lt;?php 
  if ($rand_img == "storage.jpg")
  echo "background: red;"; ?&gt;height: 100%;width:100%;"&gt;&lt;/div&gt;
  </code></pre>