function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
{
if ($spacing == 0)
{
imagettftext($image, $size, $angle, $x, $y, $color, $font, $text);
}
else
{
$temp_x = $x;
for ($i = 0; $i < strlen($text); $i++)
{
$bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);
$temp_x += $spacing + ($bbox[2] - $bbox[0]);
}
}
}
y la llamada:
imagettftextSp($image, 30, 0, 30, 30, $black, 'arial.ttf', $text, 23);
Función el orden de los parámetros cumple con el orden estándar de los parámetros de imagenttftext, y el último parámetro es el parámetro $ spacing opcional. Si no se establece o el valor pasado es 0, el espaciado entre caracteres/letras no se establece.
reemplace $ text [$ i] con mb_substr ($ text, $ i, 1) para solucionar los problemas con los caracteres mulitibyte – Juergen