How/is it possible to embed an image created with libgd directly into an html img tag?
<p>I'm trying to create an image with the php libgd library and use the variable that is being used to store the image info to embed the image on a page.</p>

<p>e.g.</p>

<pre><code>$image = get_image();

function get_image() {
    $image = imagecreate(...);
    ...
    return $image;
}

//echo '&lt;img src="'.$image.'"/&gt;';
</code></pre>

<p>Hopefully you get what I'm trying to do.. I know I can create a separate .php file that could be used like:</p>

<pre><code>echo '&lt;img src="image.php"/&gt;';
</code></pre>

<p>where image.php is..</p>

<pre><code>&lt;?php
    $image = get_image();
    header('Content-Type: image/png');
    imagepng($image);
    imagedestroy($image);
?&gt;
</code></pre>

<p>Is there anyway to avoid doing the second example, i.e. what I tried to explain the first time? </p>
