PHP image generator caching <p>I have a script that takes an image and generates a resized version. </p> <p>i.e. requesting <code>/images/50x50-logo.png</code> will call <code>image-conroller.php</code> which will then return a <code>50x50</code> version of <code>logo.png</code></p> <p>The image is returned using;</p> <pre><code>header('Content-Type: '.mime_content_type($sOutputPath)); readfile($sOutputPath); </code></pre> <p>As far as I'm aware, using this method to return the image, there is no safe way to check if the user already has a cached a version of this image. So how am I supposed to know if to send a <code>304</code> or serve the image?</p> <p>Would someone please mind explaing if it's possible to achieve this. Or provide some direction to a soloution/workaround?</p> <p>N.B. I can't think of a suitable title, any suggestions/edits would be apprecaited.</p>