🖼️ Topic Gallery

:information_source: Summary Add a gallery view for each topic
:eyeglasses: Preview Click to see a gallery example
:hammer_and_wrench: Repository Link https://github.com/Canapin/discourse-topic-gallery
:open_book: Install Guide How to install plugins in Discourse

Description

Topic Gallery displays all images from a discussion on a dedicated page.

Use cases

Ideal for image-focused communities and/or categories in which users post many pictures.
It allows for a full picture experience without the regular topic interface and other contents getting in the way.

Mobile view:

You can try it here. This is primarily a test instance, so the availability is not guaranteed.

Features

Main features

  • Infinite swiping! [1]

  • User and date filters

  • Starts gallery from a given post

  • Group-specific access

  • Category-based exclusions

  • Link to the source post below the currently open image, so you’re never lost:
    Gallery Topic source post link

  • Shows grouped pictures (belonging to the same post) on mouse over:
    Topic Gallery grouped pictures

Navigation from a topic to a gallery

Several buttons are available to navigate from a Topic to a Gallery:

  • Below the timeline:

  • At the end of a topic:
    Topic Gallery topic button

  • On each post (can be disabled in the settings):
    Topic Gallery post button
    :information_source: If we open the gallery from a post, the gallery is filtered and only shows images starting from this post. You can cancel this filter with a single click:
    image

Gallery URLs

The gallery URL syntax is the same as a regular topic, but /t/ is replaced with /gallery/:

https://canapin.discourse.diy/t/share-your-pictures/10
:backhand_index_pointing_down:
https://canapin.discourse.diy/gallery/share-your-pictures/10

There’s also a public JSON endpoint:
https://canapin.discourse.diy/gallery/share-your-pictures/10.json

Security & queries

  • Feature access is restricted to allowed groups and in allowed categories.
  • Galleries are restricted to users with access to their source topic.

Uploads queries exclude:

  • The order of pictures from a post is preserved
  • Non-user-uploaded images
  • Non-post references (custom emojis, avatars, etc.)
  • Uploads from posts that the current user has no access to, meaning:
    • Whispers (if the current user can’t see whispers)
    • Hidden posts
    • Deleted posts
    • Ignored users’ posts

Gallery Behavior

  • Hotlinked images are not shown.

  • Small images are not shown (minimum resolution can be changed in settings).

  • Duplicate images are shown once.

  • Images in quotes are shown.

Settings

Name Type Default Description
topic_gallery_enabled boolean true Enable the topic gallery plugin.
topic_gallery_allowed_groups group_list admins Groups that are allowed to access the topic gallery.
topic_gallery_minimum_image_size integer (0–1000) 64 Minimum width and height (in pixels) for images to appear in the gallery. Images smaller than this in either dimension are excluded.
topic_gallery_excluded_categories category_list "" Categories where the topic gallery is disabled. Topics in these categories will not show gallery buttons or the gallery page.
topic_gallery_post_menu_button boolean true Show a gallery button inside each post.

:information_source: By default, the plugin is enabled for admins only. Visit settings to enable other groups.


  1. Reaching the end of the first batch of images automatically loads and appends the next batch. ↩︎

12 Likes

I finally released this plugin :slight_smile:

You can see a preview here: Gallery - Share your pictures! - Canapin

1 Like

This is such a cool idea and implementation.
Will try this later but is there a way to add image description that would show on the image popup below image?

1 Like

I think you can use alt text:

![Some alt text here](upload://...)

You can also click on the above image to see the alt text.

2 Likes

Ah, there’s an oversight from me. This plugin’s photoswipe configuration seems to show the original filename instead of the custom title. I’ll fix this :slight_smile:

2 Likes

@Canapin Why not use the built-in Discourse lightbox()?