Hi! I am a newbie in here. I try to create a simple image using php gd (in a file called index.html in the public_html folder), but there is no image show up. I have a header in html code and change it afterwards. Here is the code:
<html>
<body>
<?php
$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);
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
</body>
</html>
And here is the output:
Warning: Cannot modify header information - headers already sent by (output started at /home/kimo/public_html/index.php:3) in /home/kimo/public_html/index.php on line 17
‰PNG IHDRx0nIDATX…”I Ei5Žpl{‚."YVm‚:H-38.…B!Q ”|m`—j…^›|3Œrˆ:‡œ‡ +šGr:”_hZ*&_jil{65O%Ž<_V • œiFKE?‘2hs:`GaFӁ9˧^=[/;mk 8mW&+”ij%(s(ˆ~+›E„B!y"™IENDB`‚
Could anyone let me know what I did wrong?


LinkBack URL
About LinkBacks
Reply With Quote
.

