FirraWoof / xfuraffinity

Fix embeds on chat platforms, and display mature content by default.
16 stars 0 forks source link

Gallery previews #1

Open FirraWoof opened 1 year ago

FirraWoof commented 1 year ago

What

When a user uses xfuraffinity to link to a user's gallery, we should show the first couple images (NSFW or SFW) in the preview. Discord supports multiple images in an embed (most likely through oembeds), but Telegram doesn't look like it does.

Potential issues

Telegram doesn't seem to support embedding multiple images in a convenient way (and doesn't look like it supports oembeds). To solve that issue, we could use imagemagick which is bundled in cloud functions to stitch togetehr the first couple images artificially.

Starting points

Examples

shelbyKiraM commented 1 year ago

Thoughts: I know vx (prob FX too) twitter uses c.vxtwitter to put all the images on one tweet into one image for e.g. comics. Subdomains on xfuraffinity? Also gotta pop in an issue too... Meow

FirraWoof commented 1 year ago

@shelbyKiraM Interesting! Do you know why they do it this way? I would have probably gone for the naive approach which would be to just use imagemagick to stitch the images together whenever that makes sense (i.e. rendering a preview for a gallery), but I'm definitely open to doing something else if there's a benefit!

shelbyKiraM commented 1 year ago

There's this issue but no commits referred so I'm not sure what they're using: https://github.com/dylanpdx/BetterTwitFix/issues/3

shelbyKiraM commented 1 year ago

Nevermind, looks like they're using PIL, Python's Image Library: https://github.com/dylanpdx/BetterTwitFix/blob/main/combineImg/__init__.py

shelbyKiraM commented 1 year ago

Imagemagick: is πŸ˜†

FirraWoof commented 1 year ago

Is something wrong with it? πŸ˜…

The main reason I'd use it is that it's installed by default in the google cloud runtime environment, so it's pretty convenient!

shelbyKiraM commented 1 year ago

Hehe no IMagick may be a little heavy on CPU for a little bit, but it should be fine. My worry is how long you may need to store the combo of the images for. πŸ€·πŸΌβ€β™€οΈ However, I believe (except when someone attempts to refresh the link with @WebsiteBot in Telegram), it should only need to be a temp file (datastream? That sounds cooler hehe). I know Discord re-hosts files themselves, too. IMagick & temp in memory should be good! πŸ‘πŸΌπŸ˜Έ