I like to use imagesize from PHP's GD module for uploaded avatars -- but if they are stored off-site (which usually I don't allow) a great approach is to just set min-width on it, and overflow on it's container for browsers that know not the min-width. I usually don't set the height apart from perhaps a max-height on the parent container, because if the layout can't handle different heights, there's something wrong with the layout. (Again, see why much of what your PSD jockeys call "web design" I call "not viable for web deployment")
Really though, if all you're doing is letting them upload, instead of just copying the temp file during the upload, load it into PHP, check the dimensions, resize as necessary and save it back out as a new file. This has the added bonus that you will KNOW the resulting file is actually an image, and it gives you control over the file format and encoding.
I've been working on and off for a about a year now on a drop-in 404 handler to automatically make thumbs for larger images, the code from that for preserving aspect ratio while resizing the width could work well for you. Lemme see if I can extract just that part of the code.
This is simplified down greatly:
... but shows the 'basics' of loading an image, determining the new dimensions, resizing it with a proper resample (higher quality than a flat resize), and writing it back out to a file. Naturally you'd want to add format detection, possibly play with the output sizes to see what format gives you the best new image, detect if the image is actually smaller so that you aren't enlarging it (which this routine would actually do), etc, etc...
Side note, GAH I feel dirty every time I deal with FLOOR and languages that don't actually have integer divides