This theme component adds a responsive masonry-style image gallery with customizable ordering.
When clicking on an image it will open with the default lightbox viewer.
You add the gallery by clicking on the grid icon and then adding your images. It also works by first selecting the uploaded images and then clicking the icon.
→ So what do you mean with customizable ordering?
The images can be ordered horizontally (from left-to-right) or vertically. The horizontal order is ideally for images from magazines, comic books or similar. Also, when you press next in the lightbox view the correct image will show.
The images below illustrates the difference. The one to the right has horizontal ordering.
The default order is horizontal, but can be changed in the settings. It’s also possible to change the order of a specific gallery by adding vertical/horizontal (v/h works as well) to the attribute in the composer like this
→ This component looks a lot like Joe’s Tiles image gallery. Is this a clone or what?
I’ve been using Tiles for a while and like it a lot. So yeah, you could definitely say that it’s heavily influenced by that one . But a lot of stuff differ, so decided to share it. Below is a list of some of the things that are different.
- No dependencies.
- No jquery.
- Horizontal ordering.
- Small images won’t break the layout.
- Correct preview when editing.
- Possible to select multiple rows with line breaks when adding a gallery.
- Using the API function decorateCookedElement instead of decorateCooked.
Suggestions and improvements are welcome!
Small images will show up in the gallery, but a lightbox view will not be created. That’s the default Discourse behavior. It’s however possible to change what’s considered a small image by modifying the settings
max image widthand
max image height. The default values are 690 px and 500 px, respectively.
This component uses the API version 0.8.42. If you haven’t updated since May 2020, you need to do update in order to use it.