Jump to content

n00bing around


DeathStar

Recommended Posts

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

<?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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.