This peice of code can be used for resizing images in proportion.