Check out the GD image functions in the manual. Other way is to use imagemagick if the server has one installed.
Theres plenty of examples in those funtions to resize images.
When resizing with gd, make sure to use imageCopyResampled() function. Thats the best for resizing. When you are saving the resized image with imageJpeg() function, you can set the compression(quality) in that function.
Theres also examples how to insert watermark to images in some of those comments in there...