DeathStar Posted April 4, 2007 Share Posted April 4, 2007 Hi there. I REALY feel like a n00b right now but my question is: How do i create a new line with an gd(php) image? here is my script: <?php // create a 100*30 image $im = imagecreate(195, 15); // white background and blue text $bg = imagecolorallocate($im, 0, 0, 0); $textcolor = imagecolorallocate($im, 255, 0, 0); $text = $info['name']; $text .= $info['level']; // write the string at the top left imagestring($im, 5, 0, 0, $text, $textcolor); // output the image header("Content-type: image/png"); imagepng($im); ?> Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/ Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 i treaid <br /> and \n Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220895 Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 $text = $info['name']."\n"; $text .= $info['level']; Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220898 Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 Nope.. Just outputs <sup>V</sup><sub>T</sub> in the middle Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220901 Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 Post your actual code. Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220906 Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 <?php include "db\connect.php"; include "func.php"; /* in func.php: $r = mysql_query("SELECT * FROM `users` WHERE `id`=$id"); $ir= mysql_fetch_array($r); */ // create a 100*30 image $im = imagecreate(700, 20); // white background and blue text $bg = imagecolorallocate($im, 0, 0, 0); $textcolor = imagecolorallocate($im, 255, 0, 0); $text = "Name: "; $text .= $ir['name']."\n"; $text .= "Level: "; $text .= $ir['name']; // write the string at the top left imagestring($im, 5, 0, 0, $text, $textcolor); // output the image header("Content-type: image/png"); imagepng($im); ?> Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220910 Share on other sites More sharing options...
MadTechie Posted April 4, 2007 Share Posted April 4, 2007 what about <?php $im = imagecreate(700, 30); // white background and blue text $bg = imagecolorallocate($im, 0, 0, 0); $textcolor = imagecolorallocate($im, 255, 0, 0); $text = "Name: "; $text .= $ir['name']; imagestring($im, 5, 0, 0, $text, $textcolor); $text = "Level: "; $text .= $ir['name']; // write the string at the top left imagestring($im, 5, 0, 12, $text, $textcolor); ?> Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220931 Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 doesnt work Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220951 Share on other sites More sharing options...
MadTechie Posted April 4, 2007 Share Posted April 4, 2007 erm.. did on my server please note the 12 <?php $im = imagecreate(700, 30); // white background and blue text $bg = imagecolorallocate($im, 0, 0, 0); $textcolor = imagecolorallocate($im, 255, 0, 0); $text = "Name: "; $text .= $ir['name']; imagestring($im, 5, 0, 0, $text, $textcolor); $text = "Level: "; $text .= $ir['name']; // write the string at the top left imagestring($im, 5, 0, 12, $text, $textcolor); //<------12 not 0 ?> Link to comment https://forums.phpfreaks.com/topic/45494-n00bing-around/#findComment-220956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.