Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/02/2007, 15:30
Avatar de ebe
ebe
 
Fecha de Ingreso: marzo-2004
Ubicación: Guatemala
Mensajes: 363
Antigüedad: 20 años, 1 mes
Puntos: 11
Re: mostrar solo 2 o 3 lineas del contenido de un campo de BD

te dejo este link que puede serte util

http://www.forosdelweb.com/showthrea...807#post278807

ahora para crear thumbs con tus imagenes solo debes pasarle la ruta de donde tienes guardada la imagen (asumiendo que en tu DDBB guardas unicamente la ruta de las imagenes que subes).
Código PHP:
if (!$max_width)
  
$max_width 80;
if (!
$max_height)
  
$max_height 60;

$size GetImageSize($_GET['image']);
$width $size[0];
$height $size[1];

$x_ratio $max_width $width;
$y_ratio $max_height $height;

if ( (
$width <= $max_width) && ($height <= $max_height) ) {
  
$tn_width $width;
  
$tn_height $height;
}
else if ((
$x_ratio $height) < $max_height) {
  
$tn_height ceil($x_ratio $height);
  
$tn_width $max_width;
}
else {
  
$tn_width ceil($y_ratio $width);
  
$tn_height $max_height;
}

$src ImageCreateFromJpeg($_GET['image']);
$dst imagecreatetruecolor($tn_width,$tn_height);
ImageCopyResized($dst$src0000,
    
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
ImageJpeg($dstnull, -1);
ImageDestroy($src);
ImageDestroy($dst); 
EDITADO: para utilizar este generador de imagenes optimzadas debes incluir estas lineas en su propio archivo (ej. resize_image.php) y despues llamarlo en el archivo donde mostraras las imagenes asi:

<img src="resize_image.php?image=urldelaimagen" />

lo cual te generara el thumb de tu imagen optimizada.

un saludo.
__________________
http://dev.wsnetcorp.com

Última edición por ebe; 26/02/2007 a las 17:47 Razón: add specific details for using the thumb generator.