title: How to prevent browser image caching?
body: <p>What is the best way to prevent the browser from caching images in PHP?</p>
  
  <p>I've tried the <em>header(</em> method:</p>
  
  <pre><code>header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
  </code></pre>
  
  <p>But nothings seems to work save for manually clearing the browser's cache.</p>
  
  <p>I have images that are replaced with the same name, such as <strong>avatar.png</strong> as an updateable avatar for the user, but when it is updated, the browser holds onto an old version.</p>
  
  <p>Even when the original is deleted and a new one is added, the browser still holds onto the old <strong>avatar.png</strong>.</p>
  
  <p>Any thoughts?</p>