Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/02/2005, 11:14
Cluster
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 24 años, 9 meses
Puntos: 129
Parece que alguien ya se dió el trabajo que mencionaba antes:

Cita:
deejay_world at yahoo dot com
10-Jun-2002 10:25
Width ImageString, the strings you draw are not automatically wrapped width the edge of the image. You may use this function to automatically wrap them:

Código PHP:
function ImageStringWrap($image, $font, $x, $y, $text, $color, $maxwidth)
{
   
$fontwidth = ImageFontWidth($font);
   
$fontheight = ImageFontHeight($font);

   if (
$maxwidth != NULL) {
       
$maxcharsperline = floor($maxwidth / $fontwidth);
       
$text = wordwrap($text, $maxcharsperline, "\n", 1);
     }

   
$lines = explode("\n", $text);
   while (list(
$numl, $line) = each($lines)) {
       
ImageString($image, $font, $x, $y, $line, $color);
       
$y += $fontheight;
     }
} 
So, in particular, if you want to wrap a text with the edge of the Image, you may do:
ImageStringWrap($img, $font, 0, $y, $text, $color, ImageSX($img) );
Un saludo,