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:
- Turn on error reporting
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On'); - Remove the
header()
- Remove the
@
from@imagecreatetruecolor()
- See what errors you are receiving.
精彩评论