I need to paste a text after another text using GD Library. Example here. I tried to do it the following way
$text = wordwrap($text, 80, "\n");
$count = substr_count($text, "\n");
$string_number = 14;
$pos = 0;
if ($count >= $string_number) {
for ($i = 0; $i < 14; $i++) {
$pos = stripos($text, "\n", $pos) + 1;
}
$text = substr($text, 0, $pos);
//Attempt to calculate coordinates of a text block
$text_cord = imagettfbbox(14, 0, $font_300_path, $text);
//And paste text after the end coordinate
imagettftext($image, 14, 0, 130, $text_cord[3], $blue, font_300_path, 'Need to paste');
}
imagettftext($image, 14, 0, 130, 293, $black, $font_300_path, $text);
But if I do it this way I get this
So, my question is, how can I paste a text after the other text block?
Problem solved. I just used
font_size * line_height * number_of_new_lines
to find end coordinates