bugfix in image resize

The old ratio calculation led to a distorted image and the old height was still used after resize.