I am working on gift card where the header fontsize is 100. If the header length more the 35 I want to wordwrap() that and display it in the new line.
In new line I want to display the text in center also.
Here is my code
$header=$_POST['headerdemo'];
$header = wordwrap($header, 35, "\n", true);
$headerbbox = imagettfbbox(100, 0, $font, $header);
$headerCenter = (imagesx($image) / 2) - (($headerbbox[2] - $headerbbox[0]) / 2);
imagettftext($image,100,0,$headerCenter,2100,$color,$font, $header);
In the abvoe code the headerCenter successfully center the text. It is OK for small lenth of text, but in case if wordwrap() thing happened the new line start from the left.
I want the new line also to be in center.