[ARCHIVE] Topic List Previews


(Hakan) #790

yes i am using the latest version of the plugin. Youtube is OK but I have not posted any wordpress sites.

I want visuals from within the highlighted topic instead of the favicon as the official YouTube one.


(Angus McLeod) #791

@nothing I made a change to allow onebox preview images to be the topic preview image over the weekend (commit).

Here’s an example with the same link you used in your example above. See further: Topic List Previews - Angus’ Sandbox

@bartv I’m investigating the issue you raised. Will update you hopefully by the end of today.


(Hakan) #792

I have now added and changed the pitfally change. But now I have one problem.

The thumb is not active the first time you enter the site. But when you refresh the page, the pictures come up.


(Angus McLeod) #793

Thumbnails are generated in background job which takes time to complete after the post is published, so there is always a slight time delay between publishing the post and the thumbnail becoming available in the topic list.


(Hakan) #794

Can we put a default image until the image is loaded? can you do that

edit : and even if you do not have a new topic, you do not show any images on the first entry each time you load the images.


(Angus McLeod) #795

@bartv I’ve pushed a significant refactor of how featured images are loaded in both topic lists and topics to the branch featured_images_refactor. If you could help me test that branch before it’s merged into master, that would be great.

The branch is currently live on my sandbox.

I’m not sure what you mean. Please provide me with examples. Ideally a live site rather than a screenshot.


(Bart) #796

Sure thing! Could you provide some guidance how I should switch to the branch though?


(Angus McLeod) #797

Yup, you just need to update the plugin’s line in your app.yml to:

- git clone -b featured_images_refactor https://github.com/angusmcleod/discourse-topic-previews.git

(Bart) #798

Thanks! My first observations in the featured_images_refactor branch:

  • The Featured images row no longer displays on the homepage
  • 10 Featured images are shown instead of the 6 that I configured
  • Topic preview images work ok
  • I only see one request now instead per pageview of two! :tada:

(Bart) #799

I found 2 other issues on the branch:

  • Images in the Featured row don’t link to their corresponding posts anymore.
  • I’m not 100% confident about this one - I tried to exclude my theme modifications, but it seems like there’s no rollover information on the featured images anymore, too.

Update: and one on mobile:

  • When viewing a topic on a mobile , the featured images are displayed (and they’re HUGE! :wink: )

(Stephen Chung) #800

Hi @angus, not sure if this question has been asked before (I didn’t find any)…

Is there a way to skip images that are too small to really be the main topic image? For example, my site is picking up logos of users’ company and other unimportant small images as the primary image.

Right now I believe it simply picks the first image regardless of size?


(Angus McLeod) #801

@bartv Thanks for all the useful feedback. I’ll be updating that branch in the next few days.

@schungx What’s the file type and context (e.g. onebox) of these small images?

There is currently

  • A onebox specific site-icon (.ico) and avatar image exclusion (here).

  • A general site-icon (.ico) and thumbnail image exclusion (here).

@nothing I will also look at the issue on your site as soon as possible as well. I have been busy with other work over the past two days.


(Stephen Chung) #802

Well just regular images. Actually many of those topics were created via email in, so it is like signatures and company logos.

Some of them are small images of the email system, and some of them are images such as “virus scanned” etc. All sorts.

The common characteristic is that they are all small dimensions.


(Angus McLeod) #803

hm right. Interesting. I haven’t really tested the email-in scenario with this plugin.

I’ll give it a look over the weekend and figure out a solution.


(Stephen Chung) #804

I suggestion is a minimum megapixels…


(Hakan) #805

thanks bro. im waiting.


(Angus McLeod) #806

@bartv I pushed a number of updates that address the issues you found on the featured_images_refactor branch. Give it a whirl and let me know how it goes.

@nothing’s issue was that he had changed the topic_list_test_image_url_timeout setting to 60 (milliseconds).

Generally, I recommend you leave the topic_list_test_image_url_timeout setting as is (i.e. 5000 milliseconds).


(Bart) #807

Hey @angus! Sorry for the delay - I just did a review and found some more issues:

  • In the featured images row, the username is missing.
  • On mobile, topic images aren’t square.

The following issue happens in both versions:

  • All images (both in the featured row and topics) use the full-size image, not an optimized version. - this is caused by a bug in the forum import software we’re using.

I think this one is quite relevant as it will make the pages very heavy (typically, images on our forum are 1MB+ in size).


(Bart) #808

Following up on my observation about image sizes - it seems your script grabs the version of the image as it’s included in the post. You should be able to find a smaller, more suitable image in the optimized images?


(Angus McLeod) #809

Thanks again for the feedback :+1:

This is how it works for normal previews (i.e. an optimised image is sent to the client). However this optimisation is done in sidekiq (i.e. background job) after a post is posted or edited (or the html is rebuilt).

As

  1. featured images are selected by tag, which typically doesn’t trigger the post processing sidekiq job which runs after a post is created or edited, and where optimized images are typically created;

  2. can also be of an arbitrary size and typically (almost always) a different size to the version of the image in the topic list (when the size changes you have to create a new optimized image); and

  3. there are typically only a few featured images

I haven’t yet added image size optimization to featured images.

I will add it soon though, after I’ve completed this refactor.