Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/03/2008, 09:02
Avatar de ElJavista
ElJavista
Colaborador
 
Fecha de Ingreso: marzo-2007
Ubicación: Lima Perú
Mensajes: 2.231
Antigüedad: 18 años
Puntos: 67
Re: Obtener miniatura de una imagen subida a servidor:

Bueno, una imagen de previsualización la puedes hacer tú mismo usando las liberías GD. Este es un código que hace eso, yo creo que tú eres lo suficientemente inteligente como para adapatarlo a tus necesidades.

Código PHP:
// Se obtienen las nuevas dimensiones
    
list($width$height$tip) = getimagesize($filename);
    if (
$h) {
       
$newheight $h;
       
$newwidth round(($width/$height)*$newheight);
    }  else if (
$w) {
       
$newwidth $w;
       
$newheight round(($height/$width)*$newwidth);
    }
    
// Cargar la imagen
    
$thumb imagecreatetruecolor($newwidth$newheight);
    if (
$tip == 1$source imagecreatefromgif($filename);
    elseif (
$tip == 2$source imagecreatefromjpeg($filename);
    elseif (
$tip == 3$source imagecreatefrompng($filename);

    
// Redimensionar
    
imagecopyresampled($thumb$source0000$newwidth$newheight$width$height);

    
// Mostrar la nueva imagen
    
imagejpeg($thumb$archivo);