Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/08/2012, 00:23
iScapeKiller
 
Fecha de Ingreso: abril-2011
Ubicación: Los Mochis, Sinaloa, Mexico
Mensajes: 25
Antigüedad: 13 años
Puntos: 1
Problema en salto de linea de imagen

Buenas, tengo un problema en el salto de linea de una imagen realizada en php, el problema es que cuando salto de linea quiero centrar el texto que esta saltado, pero no se como, alguna idea de como centrarlo?, aquí les dejo mi código:

Código PHP:
<?php
header
("Content-type: image/jpg");
include(
"imgbase.php");
$imagen imagecreatefromjpeg(''.$imagena.'');
//Colores
$blanco imagecolorallocate($imagen255255255);
$gris imagecolorallocate($imagen128128128);
$negro imagecolorallocate($imagen000);


// El texto a dibujar
$texto $_GET['texto'];
$texto1 $_GET['texto1'];

//Salto de Linea
$textoo wordwrap($texto18"\n"true);
$textoo1 wordwrap($texto118"\n"true);

//Fuente
$fuente 'verdanab.ttf';

//Centrar
$dimensions imagettfbbox(200$fuente$textoo);
$textWidth abs($dimensions[4] - $dimensions[0]);
$xx =(imagesx($imagen)-$textWidth)/2;

$dimensions1 imagettfbbox(200$fuente$textoo1);
$textWidth1 abs($dimensions1[4] - $dimensions1[0]);
$xx1 =(imagesx($imagen)-$textWidth1)/2;

// Añadir algo de sombra al texto
imagettftext($imagen210$xx33$negro$fuente$textoo);
imagettftext($imagen210,  $xx1358$negro$fuente$textoo1);

// Añadir el texto
imagettftext($imagen210$xx30$blanco$fuente$textoo);
imagettftext($imagen210,  $xx1355$blanco$fuente$textoo1);
imagepng($imagen);
imagedestroy($imagen);
?>
De antemano gracias por su ayuda!

Última edición por iScapeKiller; 28/08/2012 a las 00:28