Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/08/2005, 16:06
Inside PHP
 
Fecha de Ingreso: marzo-2005
Mensajes: 76
Antigüedad: 21 años, 7 meses
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_img, 0, 0, 0, 0, $width, $height, $w, $h );
    
ImageJPEG( $dst_img, '', $calidad );
    
ImageDestroy( $src_img );
    
Imagedestroy( $dst_img );
?>