Apply masonry to the gallery.