创建图像后获取空白页面

时间:2018-08-15 12:09:52

标签: php

我在下面的“ php.net”中有这段代码。如果我执行它,那么它只会给我一个黑页。是否有需要声明的内容或遗漏的内容?

<?php

header('Content-type: image/png');
$resim = imagecreatetruecolor(400, 30);
$beyaz = imagecolorallocate($resim, 255, 255, 255);
$gri = imagecolorallocate($resim, 128, 128, 128);
$siyah = imagecolorallocate($resim, 0, 0, 0);
imagefilledrectangle($resim, 0, 0, 399, 29, $beyaz);
$metin = 'Testing...';
$font = 'arial.ttf';
imagettftext($resim, 20, 0, 11, 21, $gri, $font, $metin);
imagettftext($resim, 20, 0, 10, 20, $siyah, $font, $metin);
imagepng($resim);
imagedestroy($resim);
?>

0 个答案:

没有答案