Foros del Web » Programando para Internet » PHP »

se me ven fatal las miniaturas

Estas en el tema de se me ven fatal las miniaturas en el foro de PHP en Foros del Web. Hola, he intentao hacer unas miniaturas desde un pequeño script php... pero se me ven fatal... se ven borrosas con colores malos... a ver si ...
  #1 (permalink)  
Antiguo 18/08/2005, 14:52
 
Fecha de Ingreso: agosto-2005
Mensajes: 79
Antigüedad: 18 años, 8 meses
Puntos: 0
se me ven fatal las miniaturas

Hola, he intentao hacer unas miniaturas desde un pequeño script php... pero se me ven fatal... se ven borrosas con colores malos... a ver si me podeis ayudar a mejorarlo porque no se que hacer...
os dejo mi script:
<?
header ("Content-type:image/jpeg");
$ruta="fotos/".$_REQUEST["ruta"];
$i_o = imagecreatefromjpeg($ruta);
$w_o = imagesx ($i_o);
$h_o = imagesy ($i_o);
$i_d=imagecreate(100,100);

if ($w_o>$h_o)
imagecopyresized ($i_d,$i_o,0,0,80,0,100,100,($w_o-80),$h_o);
else
imagecopyresized ($i_d,$i_o,0,0,0,80,100,100,$w_o,($h_o-80));

imagejpeg ($i_d);
imagedestroy ($i_d);
imagedestroy ($i_o);
?>
  #2 (permalink)  
Antiguo 18/08/2005, 16:06
 
Fecha de Ingreso: marzo-2005
Mensajes: 76
Antigüedad: 19 años, 1 mes
Puntos: 0
Código PHP:
<?
    Header
("Content-type:image/jpeg");

    
$imagen      = @$_GET['imagen'];

    
$calidad     85;
    
$thumbwidth  80;
    
$thumbheight 60;

    
$src_img ImageCreateFromJPEG$imagen );
    
$w imagesx$src_img );
    
$h imagesy$src_img );

    
$width$w;
    
$height$h;
    if( 
$width $thumbwidth ) {
        
$ratio $thumbwidth $width;
        
$width $thumbwidth;
        
$height $height*$ratio;
    }
    if( 
$height $thumbheight ) {
        
$ratio $thumbheight $height;
        
$height =$thumbheight;
        
$width $width*$ratio;
    }
    
    
$dst_img imagecreatetruecolor$width$height );
    
imagecopyresampled$dst_img$src_img0000$width$height$w$h );
    
ImageJPEG$dst_img''$calidad );
    
ImageDestroy$src_img );
    
Imagedestroy$dst_img );
?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:14.