$old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } else if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } else { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if ($img_type == "png") { imagepng($dst_img, $thumbname); } else { imagejpeg($dst_img, $thumbname); } imagedestroy($dst_img); imagedestroy($src_img); } } ?>