spamoom Posted March 31, 2007 Share Posted March 31, 2007 Hey all, I finally managed to get the gd2 libary installed on my server and started to look @ the gd tutorial on phpfreaks I copied and pasted the code to see what would happen..... <?php header ("Content-type: image/png"); $img_handle = ImageCreate (230, 20) or die ("Cannot Create image"); $back_color = ImageColorAllocate ($img_handle, 0, 10, 10); $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191); ImageString ($img_handle, 31, 5, 5, "My first Program with GD", $txt_color); ImagePng ($img_handle); ?> I get this when I try and view the image in firefox The image “path/img.php” cannot be displayed, because it contains errors. And in ie it tries to load the image via quicktime !? and gives me a big question mark =P Any Ideas for the image creation noob? Link to comment https://forums.phpfreaks.com/topic/45054-images/ Share on other sites More sharing options...
AndyB Posted March 31, 2007 Share Posted March 31, 2007 Remove the white space before the header() function and try again. This (below) works perfectly: <?php header ("Content-type: image/png"); $img_handle = ImageCreate (230, 20) or die ("Cannot Create image"); $back_color = ImageColorAllocate ($img_handle, 0, 10, 10); $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191); ImageString ($img_handle, 31, 5, 5, "My first Program with GD", $txt_color); ImagePng ($img_handle); ?> Link to comment https://forums.phpfreaks.com/topic/45054-images/#findComment-218720 Share on other sites More sharing options...
spamoom Posted March 31, 2007 Author Share Posted March 31, 2007 <3 woo thanks Andy Link to comment https://forums.phpfreaks.com/topic/45054-images/#findComment-218722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.