Ok so basically if I got it right you want to append images of different sizes by respecting the Aspect Ratio and therefore have them resized automatically without distortion but by adding borders instead?
Well, that seems a pretty good job for
Frosty Border!