dsyak22488 2018-04-02 21:49
浏览 42
已采纳

防止GIF字符显示在屏幕上

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?

  • 写回答

1条回答 默认 最新

  • doucong3048 2018-04-02 21:54
    关注

    imagegif — Output image to browser or file

    imagegif($gif_image);

    your writing to the screen for no reason, just remove the line

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题