I've been attempting to work with the following code to generate a background image with text on it that includes a user's name, email address, and other pertinant information. However, I can't figure out how to get the code to allow multiple lines of text. The code I'm using is here :
header("Content-type: image/png");
$im = imagecreatefrompng("images/1.png");
$font_a = 4;
$xpos_a = 5;
$ypos_a = 25;
$string_a = "$username $email $data1 $data2";
$white = imagecolorallocate($im, 255, 255, 255);
imagestring($im, $font_a, $xpos_a, $ypos_a, $string_a, $white);
imagepng($im);
I've tried to create multiple font, x and y pos, and string variables but that create an error. I've also tried to put standard HTML tags like <BR> between each variable in the string, which still only generates an image with the string on a single line with the <BR> tag between them. I've been hunting around for the last day or so looking for ways to do this with no luck... I can find hundreds of examples online about how to add text to an image, but nothing on how to add multiple lines of text to an image.
Any help would be really appreciated.