Resize an image to fit its parent element.