tonym Posted December 5, 2009 Share Posted December 5, 2009 I have this, which, apart from the header() is from the manual: <?php ob_start(); ?> <html> <body> <?php $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); header('Content-type: image/jpeg'); imagejpeg($im); imagedestroy($im); ?> </body> </html> <?php ob_end_flush(); ?> All I see in the browser is the url of the script. If I remove the header line, I see the binary source of the image. Any suggestions please? Tony Quote Link to comment Share on other sites More sharing options...
trq Posted December 5, 2009 Share Posted December 5, 2009 Considering your trying to output an image you should remove all the html tags. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 5, 2009 Share Posted December 5, 2009 Yep. You're telling PHP to output an image, yet you're telling it to feed HTML. The browser sees type "image/jpeg" Not text/html!, hense the double error. Quote Link to comment Share on other sites More sharing options...
tonym Posted December 5, 2009 Author Share Posted December 5, 2009 Thanks. Also needed to remove the flush buffer instruction. Tony Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.