title: Image processing and output using GD in php
body: <p>I want to control the display of images with the PHP GD library -- I am going to add some text to the bottom corner of it on the fly when a browser requests the image, rather than saving the text into the image.</p>
  
  <p>I know that I can do this: set the MIME type in the header and then call <code>imagepng(...)</code> with the filename to just display the image to the browser, but how would I embed it in a document? Like,</p>
  
  <pre><code>&lt;img src='somefile.php?i=1' ... /&gt;
  </code></pre>
  
  <p>do I just call <code>imagepng</code> with the filename but without setting the headers?</p>
  
  <p>Also, if someone copies the image source out of the source code and navigates to it in the browser... what will happen if the headers aren't set? Will the image display as if the actual image was requested?</p>