Yeah - I was recalculating for each line - but for some reason it would always plug in a value that wouldn't center perfectly. I went searching around though on how to use imagettfbbox and found a pretty good piece of code that centers text perfectly. It goes:
$box = imagettfbbox ($namefontsize, 0, 'Lsans.TTF', $name);
$tw=$box[2]-$box[0]; //image width
// x position
$px = (imagesx($im) -$tw)/2;
I'm repeating the code for each line I'm printing out (except I add a 1,2,3,etc to the variables). I'm not the most experienced coder though and I'm wondering if their is a better way to recalculate for each line than simply performing the script for each line. I'm thinking this is the only way though as the $string variable is different for each line of text.
Thanks for replying to my post though.
Sung