code to resize images proportionately