I've been looking for the same solution. One excellent suggestion I have gotten is to use ImageMagick. This is a set of tools that allows resizing, as well as other processing. It can be used from the command line, so it should be possible to run it in a shell or exec statement.
However, I have not been able to get it to work properly, yet, from PHP.
ImageMagick will do it better than the GIMP, and it is also "freeware". Let me know if you get it to work from a PHP script.