Hello.
We have the below code to add text onto a .png background - works perfect, except we want it to use the tahoma ttf font, and for the text to be anti aliased.
I have seen that I can use imagettftext, but whenever I use it I get errors about not enough characters. I'm sure someone here will know how to convert this, while keeping the dimensions and positioning I have already.
I have "tahoma.ttf" in my /home/Dan/img/tahoma.ttf directory
Current code:
$text = "our text would be here";
// import background image
$img = @imagecreatefrompng("/home/Dan/img/sigbg.png");
imagecreatetruecolor(322, 77);
// text color
$textcolor = imagecolorallocate($img, 245, 245, 245);
// add the text to the image ,
$textarr = explode("\n",$text);
$i = 8;
foreach($textarr as $a){
imagestring($img, 2, 96, $i, $a, $textcolor);
$i=$i+16;
}
// date in the past, so that the image is not cached by the browser
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// tell the browser what it's about to recieve
header("Content-type: image/png");
// create the png image
imagepng($img);
// clean up
imagedestroy($img);