Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/09/2008, 06:20
Juan_Bautista
 
Fecha de Ingreso: septiembre-2008
Mensajes: 19
Antigüedad: 15 años, 8 meses
Puntos: 5
Respuesta: Problema al generar thumbnail

Hola,

El problema está en la función, en las líneas:

imagejpeg($thumb,'thumb.jpg',90);
return '<img border="0" src="thumb.jpg" width="200" height="150">';

ya que el nombre de la imagen miniatura 'thumb.jpg' siempre es el mismo, con lo cual todos los <a href....> están referenciando este nombre.

Prueba por ejemplo así:

Código PHP:
function mini ($imagen) { 
    static 
$var=0;
    if (
filesize($imagen) < 500000) { 
        
$original imagecreatefromjpeg($imagen); 
        
$thumb imagecreatetruecolor(200,150); 

        
$ancho imagesx($original); 
        
$alto imagesy($original); 

        
imagecopyresampled($thumb,$original,0,0,0,0,200,150,$ancho,$alto);  

        
$dst_imagen='thumb'.$var.'.jpg';
        
imagejpeg($thumb,$dst_imagen,90); 
        
$var++;
        return 
'<img border="0" src="'.$dst_imagen.'" width="200" height="150">'
    } 
    else { 
        return 
'<img border="0" src="'.$imagen.'" width="200" height="150">'
    }