Anyone know of a script whereby a user can upload an image, have a white background added to make it square (based on the longest dimension of the image - x or y) and THEN re-size it to two different sizes (in my case 400 x 400 & 100 x 100).

This is for our online shops where shop owners either don't know how to use an image manipulation program, or they re-size images in one dimension only, which distorts them badly. Also and most importantly, a square format ensures that all the images centre to each other, both vertically and horizontally. An automated feature like this in all of our sites will save a lot of time and make the shops look a whole lot more professional