Ver Mensaje Individual
  #22 (permalink)  
Antiguo 04/06/2005, 18:19
okram
Invitado
 
Mensajes: n/a
Puntos:
longitud

muchas gracias!!! ... lo de la hora ya lo arregle y esta todo bien... para crear la imagen estoy usando este codigo:

Código PHP:
<?php 
header
("Content-type: image/jpeg"); 
include(
"connect.php"); 
$link Conectarse();

$query "SELECT * FROM news WHERE id=$codnew";
$news mysql_query($query) or die("Select Failed!");
while (
$new mysql_fetch_array($news)) {

  
$im imagecreatefromjpeg("news_title_1.jpg"); 
  
$blanco imagecolorallocate($im255255255);
  
$h explode("-",$new['dia']);
  if (
$h[1] == 01) {$mes "Enero";}
  if (
$h[1] == 02) {$mes "Febrero";}
  if (
$h[1] == 03) {$mes "Marzo";}
  if (
$h[1] == 04) {$mes "Abril";}
  if (
$h[1] == 05) {$mes "Mayo";}
  if (
$h[1] == 06) {$mes "Junio";}
  if (
$h[1] == 07) {$mes "Julio";}
  if (
$h[1] == 08) {$mes "Agosto";}
  if (
$h[1] == 09) {$mes "Setiembre";}
  if (
$h[1] == 10) {$mes "Octubre";}
  if (
$h[1] == 11) {$mes "Noviembre";}
  if (
$h[1] == 12) {$mes "Diciembre";} 
  
$getdate $h[2]." de ".$mes;
  
$posx1 = (imagesx($im)-9*strlen($getdate))/2
  
$posx2 = (imagesx($im)-7.2*strlen($new['hora']))/2
  
$posx3 = (imagesx($im)-6*strlen($new['title']))/2;
  
imagettftext($im150$posx128$blanco"hodges.ttf"$getdate); 
  
imagettftext($im70$posx239$blanco"verdana.ttf"$new['hora']); 
  
imagettftext($im80$posx358$blanco"verdana.ttf"$new['title']); 
  
imagejpeg($im); 
  
imagedestroy($im); 

}
?>
de tal manera que pone:

Fecha (En formato dia de Mes)
Hora
Titulo

una pregunta mas:

como veras estoy centrando los textos con este codigo:

Código PHP:
  $posx1 = (imagesx($im)-9*strlen($getdate))/2
  
$posx2 = (imagesx($im)-7.2*strlen($new['hora']))/2
  
$posx3 = (imagesx($im)-6*strlen($new['title']))/2
tres variables porque cada una tiene un tamaño de texto diferente... practicamente estoy sorteando el tamaño si me entiendes. No hay alguna forma de hacer que este quede siempre centrado sin importar el tamaño de la letra????

gracias!