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); ?> Quote Link to comment Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 i treaid <br /> and \n Quote Link to comment Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 $text = $info['name']."\n"; $text .= $info['level']; Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 Post your actual code. Quote Link to comment 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); ?> Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
DeathStar Posted April 4, 2007 Author Share Posted April 4, 2007 doesnt work Quote Link to comment 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 ?> 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.