Código PHP:
header("Content-type: image/jpeg");
$imagen = imagecreatefromjpeg('personajes/1.jpg');
$negro = imagecolorallocate($imagen, 0, 0, 0);
$white = imagecolorallocate($imagen, 255, 255, 255);
$texto="HOLA";
$fuente ="impact.ttf";
$longitud = imagesx($imagen);
$bounds[] = array();
$bounds = imageftbbox(30,0,$fuente, $texto);
$x = $bounds[0] + ($longitud / 2) - ($bounds[4] / 2);
imagettftext($imagen, 30, 0, $x, 50, $white,$fuente,$texto);
imagejpeg($imagen);
imagedestroy($imagen);
Existe alguna manera que yo pueda identificar si el texto sale de la imagen?