PHP don't respond after imagedestroy
<p>While developing I faced a problem. After calling imagedestroy my script won't execute some PHP nor HTML.</p>

<p>When I delete the header it execute the PHP / HTML after the imagedestroy, but I need that header in my script. So my question is; how can a PHP header affect the PHP script.</p>

<pre><code>&lt;?php

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


$im = @imagecreatefrompng('ticket.png') or die("Cannot select the correct image. Please contact the webmaster."); 
$text_color = imagecolorallocate($im, 0,0,0); 

/*
$name = $_GET['name'];
$from = $_GET['from'];
$to = $_GET['to'];
$time = $_GET['time'];
$date = $_GET['date'];
$agent = $_GET['agent'];
$sno = $_GET['sno'];
$flightno = $_GET['flightno'];
$boardingtime = $_GET['boardingtime'];
$gate = $_GET['gate'];
$seat = $_GET['seat'];
*/

$name = $_POST['name'];
$from = $_POST['from'];
$to = $_POST['to'];
$time = $_POST['time'];
$date = $_POST['date'];
$agent = $_POST['agent'];
$sno = rand(101, 199);
$flightno = $_POST['flightno'];
$boardingtime = $_POST['boardingtime'];
$gate = $_POST['gate'];
$seat = $_POST['seat'];

$text_name = "$name"; 
$text_from = "$from";
$text_to = "$to";
$text_time = "$time";
$text_date = "$date";
$text_agent = "$agent";
$text_sno = "$sno";
$text_flightno = "$flightno";
$text_boardingtime = "$boardingtime";
$text_gate = "$gate";
$text_seat = "$seat";

$font = 'font.ttf';

#Basis in het midden.
imagettftext($im, 12, 0, 119, 168, $text_color, $font, $text_name);
imagettftext($im, 12, 0, 119, 184, $text_color, $font, $text_from);
imagettftext($im, 12, 0, 100, 201, $text_color, $font, $text_to);
imagettftext($im, 12, 0, 185, 235, $text_color, $font, $text_time);
imagettftext($im, 12, 0, 498, 167, $text_color, $font, $text_date);
imagettftext($im, 12, 0, 509, 184, $text_color, $font, $text_agent);
imagettftext($im, 21, 0, 544, 260, $text_color, $font, $text_sno);

#Top
imagettftext($im, 14, 0, 97, 85, $text_color, $font, $text_flightno);
imagettftext($im, 14, 0, 289, 85, $text_color, $font, $text_boardingtime);
imagettftext($im, 14, 0, 398, 85, $text_color, $font, $text_gate);
imagettftext($im, 14, 0, 486, 85, $text_color, $font, $text_seat);

$rand = rand(0, 3498);
imagepng($im);
imagepng($im, 'images/' . $rand . '.png'); 
imagedestroy($im);

echo 'This does not display';

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