this post was submitted on 18 Jan 2025
34 points (100.0% liked)

Lemmy Apps

6644 readers
1 users here now

A home for discussion of Lemmy apps and tools for all platforms.

RULES:


An extensive list of Lemmy apps is available here:

LemmyApps.com

or lemmyapps.netlify.app


Visit our partner Communities!

Lemmy Plugins and Userscripts is a great place to enhance the Lemmy browsing experience. !plugins@sh.itjust.works

Lemmy Integrations is a community about all integrations with the lemmy API. Bots, Scripts, New Apps, etc. !lemmy_integrations@lemmy.dbzer0.com

Lemmy Bots and Tools is a place to discuss and show off bots, tools, front ends, etc. you’re making that relate to lemmy. !lemmy_dev@programming.dev

Lemmy App Development is a place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform. !lemmydev@lemm.ee

founded 2 years ago
MODERATORS
 

I've seen a lot of wishes in various comments and feature requests for Lemmy to support image galleries (e.g. similar to Reddit posts with multiple images you can swipe through).

My first thought was to just detect multiple images in the post body and render those (plus the thumbnail) as a gallery instead of just the thumbnail image. That's absolutely doable, but perhaps there's a better way?

My second thought, which is what I now prefer, was to make a custom markdown container for an image gallery (the same way the spoiler tag is implemented).

e.g.

:::gallery Gallery Title
![Image 1 Alt Text](https://example.com/image1.jpg "Caption for Image 1")
![Image 2 Alt Text](https://example.com/image2.jpg "Caption for Image 2")
![Image 3 Alt Text](https://example.com/image3.jpg "Caption for Image 3")
:::

It would then render that as an image gallery that can be swiped through.

Pros

  • Easy to implement in most markdown libraries that support custom containers (markdown-it, marked-js, etc)
  • Easy syntax for users
  • Allows explicitly creating a gallery instead of relying on implicit behavior (e.g. detecting / rendering multiple post body images as a gallery)

Cons

  • The custom markdown container would need to be implemented by clients (preferably more than just one or two)
  • It wouldn't work in Lemmy-UI (hey, they should have to adopt one of our features for a change)
  • The "title" component of the markdown image syntax would be interpreted by some clients as the code for a custom emoji, so that may need to be omitted if we want this to fail mostly-gracefully in less capable apps (cough Lemmy UI cough).

Thoughts? Other suggestions?

you are viewing a single comment's thread
view the rest of the comments
[–] ptz@dubvee.org 5 points 7 months ago* (last edited 7 months ago)

Assuming the custom container for galleries doesn't take off, my backup plan is to use my original idea of detecting multiple images in the post bodies and populating a gallery. To make that behavior explicit, I would probably only trigger that behavior if the post title has a gallery tag/flair (eg. Check out my vaction photos [Gallery]).

Either way, I'd like to get feedback from other app developers to see if they'd be interested in supporting similar behavior and standardizing it.