title: PHP: Grab an image from a stream (in an img tag) but if it's not there, i don't want the img tag written. How?
body: <p>I currently have code like this in a web based file called 'view_file.php' to grab an image from an internal network.</p>
  
  <pre><code>&lt;img src="put_file.php?type=&lt;?=$TN_TYPE;?&gt;&amp;path=&lt;?=$TN_PATH;?&gt;&amp;filename=&lt;?=$TN_FILENAME;?&gt;" /&gt;
  </code></pre>
  
  <p>The 'put_file.php' script allows access to an internal server that we don't want to expose to the internet. This script checks to see if an image is available and if it is, sends an image header and then uses <code>readfile()</code> to stream the image to the 'view_file.php' page.</p>
  
  <p>The problem is if there isn't an image available, instead of streaming a temporary 'spacer.gif' i want to not have the img tag written at all.</p>
  
  <p>Any Ideas how to do this?
  I'm thinking maybe move the img tag into the 'put_file.php' script, but how to mix strings and steams?</p>