fatpandahk99
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 0
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 before and change it afterwards. Here is the code:
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 9
‰PNG IHDRxÉ0n¤æIDATX…í”Ià EiÕ5ÛŽóåpl{‚."YVüm‚:Hÿ-Á38.…B!äÜìQ¯ ”ò|mÐ`—j…^›§|Ê3Œrˆè:‡œ‡ ç+šGr:”Îù_«hZÑõ*&¸_´ïµé·Ù÷²jil{6Þè5ãÇóà²ÒO%Ž<_Vä• «œiFèºÍä¯ÕK¾åÄE?ì‘2hs:¡`ÜçGaFÙÓ9˧^=[Ù/;Ãm»Ãk 8mW&Ç+”ij%(s(ˆõ~+›E¬Ð„B!äßy¤Í"¥™íIEND®B`‚
Could anyone let me know what I did wrong? Thank you!
HTML:
<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 9
‰PNG IHDRxÉ0n¤æIDATX…í”Ià EiÕ5ÛŽóåpl{‚."YVüm‚:Hÿ-Á38.…B!äÜìQ¯ ”ò|mÐ`—j…^›§|Ê3Œrˆè:‡œ‡ ç+šGr:”Îù_«hZÑõ*&¸_´ïµé·Ù÷²jil{6Þè5ãÇóà²ÒO%Ž<_Vä• «œiFèºÍä¯ÕK¾åÄE?ì‘2hs:¡`ÜçGaFÙÓ9˧^=[Ù/;Ãm»Ãk 8mW&Ç+”ij%(s(ˆõ~+›E¬Ð„B!äßy¤Í"¥™íIEND®B`‚
Could anyone let me know what I did wrong? Thank you!