Hello, beginner here. I figured out how to center text horizontally but for the life of me I can't figure out how to center it vertically. So I end up just sticking in some number that sort of works... Could someone make a few minor alterations to this code to try and help me out?
Thanks,
Randy
<?
$x_image=450;
$y_image=100;
$id=imagecreate($x_image,$y_image);
$white = ImageColorAllocat($id,255,255,255);
$header="Text";
$ttf_font = "arial.ttf";
$head_size=40;
#I know the following is supposed to be different
$tmpy=ImageTTFBBox($head_size,0,$ttf_font,$header);
$tmpx=ImageTTFBBox($head_size,0,$ttf_font,$header);
$hx=($x_image-$tmpy[2])/2;
$hy=($y_image-$tempx[2])/2;
$cyan = ImageColorAllocate($id, 37,44,180);
ImageTTFText($id,$head_size,0,$hx,$hy,$cyan,$ttf_font,$header);
imagegif($id);
imagedestroy($id);
?>