Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix video thumbnail generation (fixes #3484) #4539

Merged
merged 2 commits into from Mar 15, 2024
Merged

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Mar 15, 2024

While looking into the linked issue I noticed a few issues with thumbnail generation. I probably introduced them while implementing the image proxying.

generate_thumbnail: bool,
context: &LemmyContext,
) -> Option<DbUrl> {
let is_image = content_type.as_ref().unwrap_or(&mime::TEXT_PLAIN).type_() == mime::IMAGE;
if generate_thumbnail && is_image {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually checking the thumbnail of the post.url, ie a youtube.com url. So this would give is_image = false even for a valid opengraph thumbnail.

.unwrap_or(url);
generate_pictrs_thumbnail(image_url, context)
.await
.ok()
.map(Into::into)
} else {
None
opengraph_data.image.clone()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simply hotlink the thumbnail from the original website in this case.

@dessalines dessalines merged commit 43378c5 into main Mar 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants