Ver Mensaje Individual
  #13 (permalink)  
Antiguo 22/02/2008, 10:19
Avatar de DooBie
DooBie
 
Fecha de Ingreso: septiembre-2004
Mensajes: 1.101
Antigüedad: 19 años, 7 meses
Puntos: 71
Re: Tamaño imagen

Código PHP:
    function miniatura($nombre_imagen$nombre_miniatura$thumbWidth){ // Crea una imagen en miniatura del fichero pasado por parametros a la anchura tambien pasada por parametros
        
$img imagecreatefromjpeg($nombre_imagen);
        
$width imagesx($img);
        
$height imagesy($img);
        
// calcula el tamaño
        
$new_width $thumbWidth;
        
$new_height floor($height*($thumbWidth/$width));
        
// crea una nueva imagen de manera temporal
        
$tmp_img imagecreatetruecolor($new_width$new_height);
        
// copia y redimensiona la nueva imagen en la temporal que hemos creado
        
imagecopyresized($tmp_img$img0000$new_width$new_height$width$height);
        
// guarda el thumbnail en un archivo
        
imagejpeg($tmp_img$nombre_miniatura);
        
imagedestroy($tmp_img);
    }

miniatura("miimagen.jpg""thumb_miimagen.jpg"80); 
toma el codigo hecho, a mi me funciona, lo tengo en mas de una pagina en funcionamiento sin ningun tipo de problema.


Por cierto, no envies MP, si no contesta la gente en el hilo, será por algo, saludos!