开发者

PHP image failing to do, well, anything

<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
      or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
imagep开发者_StackOverflow社区ng($im);
imagedestroy($im);
?>

That should work, but is just showing a blank page. I have php-gd installed. Help?


Try some debugging steps:

  1. Turn on error reporting
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', 'On');
  2. Remove the header()
  3. Remove the @ from @imagecreatetruecolor()
  4. See what errors you are receiving.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜