and you probably want nice things like if you adjust one of the heights the other adjusts accordingly
Google php and GD2, or php and ImageMagik. You may have to increase php's memory limits if sizing big images.
Cheers Chris