adapt the number of photos per line to the window width