yami007 Posted October 8, 2009 Share Posted October 8, 2009 this is the code so far : <? Header("Content-type: image/png"); $im = ImageCreate(630,80); $blue = ImageColorAllocate($im,0x5B,0x69,0xA6); $white = ImageColorAllocate($im,255,255,255); $black = ImageColorAllocate($im,0,0,0); ImageTTFText($im, 45, 0, 10, 57, $black, "CANDY", $text); ImageTTFText($im, 45, 0, 6, 54, $white, "CANDY", $text); ImagePNG($im); ?> <IMG src="txt.php?text=<?echo urlencode($text)?>"> well this isnt my code, this is from the PHP ADVANCED TUTORIAL. i followed the example untill the end but i ddnt work and gave me that error. where is the problem?? Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/ Share on other sites More sharing options...
johnsmith153 Posted October 8, 2009 Share Posted October 8, 2009 last line: <IMG src="txt.php?text=<?echo urlencode($text)?>"> change to: <IMG src="txt.php?text=<?echo urlencode($text);?>"> Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-933397 Share on other sites More sharing options...
yami007 Posted October 8, 2009 Author Share Posted October 8, 2009 <IMG src="txt.php?text=<?echo urlencode($text);?>"> thanks, but it's still not working Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-933402 Share on other sites More sharing options...
johnsmith153 Posted October 8, 2009 Share Posted October 8, 2009 what is the error? Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-933403 Share on other sites More sharing options...
yami007 Posted October 8, 2009 Author Share Posted October 8, 2009 it's still giving this error : The image “http://localhost/test/create_png.php” cannot be displayed, because it contains errors. Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-933411 Share on other sites More sharing options...
PFMaBiSmAd Posted October 9, 2009 Share Posted October 9, 2009 You cannot output image data and HTML on the same page. Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-933435 Share on other sites More sharing options...
yami007 Posted October 9, 2009 Author Share Posted October 9, 2009 yes thanks Link to comment https://forums.phpfreaks.com/topic/177026-solved-the-image-cannot-be-displayed-because-it-contains-errors/#findComment-934028 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.