the resize then crop approach: compute the aspect ratio of the source image and use it as a constraint to create an intermediate image which is going to be larger than the destination image (either in width or height) - finally crop the intermediate image to the destination dimensions.
use seam carving! also called "liquid rescale" in ImageMagick (see also there)
If you can rely on ImageMagick being installed on your server, it offers many more features than GD.