I have this nice bit of code that generates a gif on the fly, where I place text over an existing image:
<?
$pic_name = "test.gif";
$gif_image = imagecreatefromgif('background.gif');
$text_color = imagecolorallocate($gif_image, 0, 0, 0);
$font_path = 'arial.ttf';
$text = "E-Signed By:";
imagettftext($gif_image, 6, 0, 72, 11, $text_color, $font_path, $text);
imagegif($gif_image);
imagegif($gif_image, $pic_name);
imagedestroy($gif_image);
?>
When I am done creating the image, I redirect to the next page:
echo
"<html>
<head>
<meta HTTP-EQUIV='REFRESH' content='0; url=https://emortgagecapital.com/mlo/agreement.php'>
</head>
</html>";
The glitch is, on the redirect, for only a moment, I see a very long string of the GIF special characters, that looks something like this:
GIF87aR�9Z�9c�Bc�Jk�Rs�Z{�k��s��{�����
There is a lot more, but you get the idea.
Now, if I leave this bit of code in, the special characters don't display, but it kills the further execution of the script, and simply displays the image on screen:
header('Content-type: image/gif');
I tried placing the redirect as the header, but then the image never rendered and did not save to the server - the main reason for the script.
How do I run this script, and redirect, so the special characters do not 'flash' on the screen?