correctly calculate height of images on window load