this post was submitted on 30 Nov 2024
12 points (100.0% liked)

Lemmy Support

4663 readers
8 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

Solution

As was pointed out by @SatyrSack@feddit.org ^[1]^, this feature was added in this pull request. It appears that the custom thumbnail field is only relevant for posts that share a URL: The "Thumbnail URL" field is used to specify a custom thumbnail to be used in place of what would've been automatically generated by the provided URL ^[2]^.

Original Post

I thought it would be for adding a custom thumbnail that appears for the post in the feed, but then that seems to be a duplicate of adding an image. At any rate, I tried adding an image link to it, and no image showed up for the post. So I'm not entirely sure what it's actually for.

EDIT (2024-11-30T22:22): Perhaps it's for the pre-expanded thumbnail for a post if it has an image? Does that mean that it only works if you have an image specified? Can it be used to override the thumbnail that's generated from a shared article? Does it work for a text post?

References

  1. @SatyrSack@feddit.org [To: "When creating a post, how does the "Thumbnail URL" option work exactly?". "Kalcifer" (@Kalcifer@sh.itjust.works). sh.itjust.works. Published: 2024-11-30T22:24:10Z. Accessed: 2024-12-02T07:06Z. https://sh.itjust.works/post/28843300]. Feddit.org. Published: 2024-12-01T23:37:14Z. https://feddit.org/comment/3413077.
  2. "crates/api_crud/src/post/create.rs". LemmyNet/Lemmy. GitHub. Published: 2024-12-01T01:14:07.000Z. Commit: 5085d1c. Accessed: 2024-12-02T06:40Z. https://github.com/LemmyNet/lemmy/blob/e49d346535f0769b85ad0fa4b0baabfbdba0deff/crates/api_crud/src/post/create.rs.
    • L91-L99
      // Only generate the thumbnail if there's no custom thumbnail provided,
      // otherwise it will save it in pictrs
      let generate_thumbnail = custom_thumbnail.is_none();
      
      // Fetch post links and pictrs cached image
      let metadata = fetch_link_metadata_opt(url.as_ref(), generate_thumbnail, &context).await;
      let url = proxy_image_link_opt_apub(url, &context).await?;
      let thumbnail_url = proxy_image_link_opt_apub(custom_thumbnail, &context)
        .await?
        .map(Into::into)
        .or(metadata.thumbnail);
      
      • L93: A check is done for whether a custom thumbnail URL was provided.
      • L96: If it wasn't, then one will be generated from the shared URL.
      • L98: If a custom thumbnail URL was provided, it will be fetched from pictrs.
      • L99: If a custom thumbnail was not provided, fallback to the generated thumbnail.
top 5 comments
sorted by: hot top controversial new old
[–] andrew_s@piefed.social 3 points 3 days ago (1 children)

I assumed that was there because there are some sites (e.g. reuters.com) that make it difficult to automatically grab a thumbnail image to go with the article. So if you're posting a link to somewhere like there, you'd find a relevant image manually, and use that field so the post you make will be more engaging.

I don't think it's for posts that are an image - in that case, the software can just use that to create a thumbnail, so it doesn't need the extra help.

[–] Kalcifer@sh.itjust.works 1 points 3 days ago (1 children)

I assumed that was there because there are some sites (e.g. reuters.com) that make it difficult to automatically grab a thumbnail image to go with the article. So if you're posting a link to somewhere like there, you'd find a relevant image manually, and use that field so the post you make will be more engaging.

So are you saying that it only works for posts that are sharing a URL?

[–] SatyrSack 2 points 3 days ago (1 children)

If the URL being posted is anything other than an image, yes. If the URL being posted is a video, an article, an MP3, whatever. If you don't want to leave it up to Lemmy to try to grab a thumbnail do display for the post, you have the option to expicitly specify the thumbnail image to be used.

On the other hand, if the URL that you are posting is itself an image (JPEG, PNG, GIF, WEBP, whatever), you might notice that the "Thumbnail URL" field disappears. Because Lemmy will use the image you are posting as the thumbnail.

[–] Kalcifer@sh.itjust.works 1 points 2 days ago (1 children)

Out of curiosity, for reference, could you cite official documentation and/or source code for where that functionality is defined?

[–] SatyrSack 2 points 2 days ago* (last edited 2 days ago)

I do not see any documentation, but here is the pull request for the feature that was added in v0.19.4

https://github.com/LemmyNet/lemmy/pull/4425