I have searched for, but have been unable to find, a script to place on the server that will automatically optimize (both pixel size and file size) images that a client uploads to their site via a CMS.
For example, if you upload a huge image to eBay, it sizes the image down automatically for optimized viewing.
Anyone know if such a script exists? Or, does anyone have any tips for writing such a script in PHP or something?
Sounds like you're looking for ImageMagick. Have a look at http://coppermine.sourceforge.net/. That's a photo gallery that does exactly what you're asking. Upload a pic, and ImageMagick will create different sizes of that pic (file size as well as pixel size), and retain the correct aspect ratio for each picture.
I know Coppermine can be integrated with various bulletin board software. Maybe it can also be integrated with a few CMS's? No idea. I'm afraid.
I can give you C# code to resize an image as its uploaded, this is something that is used in one of my current sites, and it works well, although it doesn't actually optimise the image using bicubic resizing etc, so the results may be a little bit pixellated.