PHP gd2 code not working
<p>I have the following chunks of php code. the first does work, the second generates a broken image. have been trying to figure out why for like 2 hours...</p>

<p>this one is OK:</p>

<pre><code>&lt;?php ?&gt;
&lt;?php

    header("Content-Type: image/png");    

    $handle = ImageCreate (180, 150); 
    $bg_color = ImageColorAllocate ($handle, 255, 0, 0); 
    ImagePng ($handle);

?&gt; 
</code></pre>

<p>This one generates a broken image:</p>

<pre><code>&lt;?php

    header("Content-Type: image/png");    

    $handle = ImageCreate (180, 150); 
    $bg_color = ImageColorAllocate ($handle, 255, 0, 0); 
    ImagePng ($handle);

?&gt;       
</code></pre>

<p>As you can see the only difference is the php tag opened and closed on top of the file... I suppose it's an issue with the header, but can't figure out what issue</p>

<p>running PHP 5.4.7 on Apache  2.4.3 (XAMPP 3.1.0)</p>
