Resize images to fit the grid