title: Output a PNG image from a PHP include file
body: <p>I have a include file called sign.php which has some code - </p>
  
  <pre><code>header('Content-type: image/png');
  .....
  imagepng($image_file);
  .....
  </code></pre>
  
  <p>A file where I want to display this image - index.php</p>
  
  <pre><code>......
  &lt;what comes here?&gt; include('../sign.php');
  .....
  </code></pre>
  
  <p>How would I display it? Directly echo-ing it doesn't work!</p>
  
  <p>Thanks.</p>
  
  <p>MORE CODE:</p>
  
  <p>sign.php</p>
  
  <pre><code>    .....
     {
      imagettftext($im, 22, 0, 240, 43 , $text_color, $font, $text_god);
      imagettftext($im, 22, 0, 241, 44 , $text_color, $font, $text_god);
  }
  imagettftext($im, 22, 0, 60, 42 , $text_color, $fontname, $text_username);
       imagettftext($im, 16, 0, 230, 72 , $text_color, $font, $text_kills);
  imagettftext($im, 16, 0, 230, 102 , $text_color, $font, $text_deaths);
  imagettftext($im, 16, 0, 230, 132 , $text_color, $font, $text_rwon);
  
  imagettftext($im, 16, 0, 365, 72 , $text_color, $font, $text_alevel);
  imagettftext($im, 16, 0, 365, 102, $text_color, $font, $text_dlevel);
  imagettftext($im, 16, 0, 365, 132 , $text_color, $font, $text_rlost);
  imagettftext($im, 16, 0, 365, 162 , $text_color, $font, $text_money);   // Prints the money in the picture. 
  
  imagecopymerge($im, $skinImg, 505, 56,0,0,55,99,100);
  
  header('Content-Type: image/png');
  
  imagepng($im); 
  
      imagedestroy($im); 
  </code></pre>
  
  <p>index.php</p>
  
  <pre><code>    .......
      &lt;?php echo '&lt;img src="../signature/sign.php" /&gt;'; ?&gt;
      .......
  </code></pre>
  
  <p>Still doesn't work!</p>
  
  <p>EDIT:</p>
  
  <p>index.php</p>
  
  <p>
  
  <pre><code>            include('../signature/sign.php');
  
              echo '&lt;img src="data:image/png;base64,' + base64_encode($stringdata) + '"&gt;';
  </code></pre>
  
  <p>sign.php</p>
  
  <p><a href="http://pastebin.com/uz1U3V4R" rel="nofollow">http://pastebin.com/uz1U3V4R</a></p>