Thumbnails layout in gallery is highly customizable. Thumbnails could have some regular matrix layout with square or rectangle shape. Also one of the main options it’s random grid layout. 2JPhotoGallery have advanced settings for configuration of the grid view.