Codice PHP:

    
function SaveProportionateImage($filename$quality$height 0$width 0){ 

        if(
$height)  {

           
$dest_height $height

           
$ratio $this->src_height $dest_height

           
$dest_image imagecreatetruecolor$this->src_width $ratio,$dest_height); 

        } elseif(
$width) {
           
           
$dest_width $width

           
$ratio $this->src_width $dest_width

           
$dest_image imagecreatetruecolor(  $dest_width$this->src_width $ratio); 

        } else {

           return 
false;

        }

        
imagecopyresampled($dest_image$this->src_image0000

            
$this->src_width $ratio

            
$this->src_height $ratio

            
$this->src_width

            
$this->src_height); 

        
imagejpeg($dest_image$filename.'.jpg'$quality); 

        
imagedestroy($dest_image); 

    } 
Non l'ho provata ma dovrebbe andare... certo che ci potevi ragionare sopra un pochino....

ciao

[edit]
ci hai ragionato... la mia + più bella però, la puoi usare in tutti e due i modi