class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I've this piece of code which works perfectly on Windows but does not work in Linux VPS. On Windows I can overwrite the image with a new one, convert to 'jpg' and also resize to 128x128. I checked the logs
$foo->log says -no image processing wanted
image 'upload' directory has permission set to 755 drwxr-xr-x 3 apache apache 4096 May 26 15:03 uploads
$foo->log says
-no image processing wanted
image 'upload' directory has permission set to 755
drwxr-xr-x 3 apache apache 4096 May 26 15:03 uploads
My php.ini
memory_limit = 128M