[man]gd[/man] the GD library is what would mainly be used. Of course, that coupled with the [man]image[/man] functions. You'd want:
[man]imagecreatefromjpeg[/man](path to jpeg image); <-- get the resource image handle
[man]imagecopyresampled[/man]($im, resource image handle, 0,0,0,0, new width, new height, orig width, orig height);
[man]imagegif/man;
That should get you moving...