How to proportionally scale images that have dimension attributes