Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/10/2010, 04:55
koxder
 
Fecha de Ingreso: octubre-2010
Mensajes: 2
Antigüedad: 13 años, 6 meses
Puntos: 1
Problema al escribir texto en imagen

Hola mi problema es que intento introducir texto en una imagen, y en ocasiones lo incrusta bien pero en otras el texto sale todo pixelado.. he probado todas las opciones para el color del texto y no tiene nada que ver con eso: el codigo es el siguiente:


$ind =imagecolorallocate($im,$red,$green,$blue);

imagettftextalign($im, $size, 0, $x, $y, $ind, $font, $text,"C");


function imagettftextalign($image, $size, $angle, $x, $y, $color, $font, $text, $alignment='L')
{
//check width of the text
$bbox = imagettfbbox ($size, $angle, $font, $text);
$textWidth = $bbox[2] - $bbox[0];
switch ($alignment) {
case "R":
$x -= $textWidth;
break;
case "C":
$x -= $textWidth / 2;
break;
}
//write text
imagettftext ($image, $size, $angle, $x, $y, $color, $font, $text);
}

Muchas gracias.