($setHeight/$height)?$setHeight/$height:$setWidth/$width; $newWidth = floor($width*$rate); $newHeight = floor($height*$rate); $sim = $this->setImageType($imgPath, $imgInfo[2]); $dim = imagecreatetruecolor($newWidth, $newHeight); imagecopyresampled($dim, $sim, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); $image = $this->exportImage($imgPath, $dim, $suf); imagedestroy($sim); imagedestroy($dim); return $image; } public function __destruct(){ //TODO } }