Add lazy loading images and grid layout in rows to images
This adds lazy loading to images from queries so they do not all load at
the same time, which is very slow and a bad user experiance for large
queries. This also improves the layout and arranges the images in order.
The heights of images must be uniform within a row so that they do not
stagger at the bottom.