Topic List Previews (legacy)

Hi, is possible get thumbnail from first image in the post uploaded with imgur?
Thanks!

2 Likes

I donā€™t believe so. Thumbnails are only generated from uploads. Uploads can be stored remotely though as per normal Discourse, eg on S3 storage.

2 Likes

I think Iā€™ve found a little bug. I have my categories set to sort by creation date which the TC uses and all works as expected. But when someone replies to a topic and then goes back to the category it shows at the top of the page until the user refreshes the page, then it returns to itā€™s correct spot. It may be related to this fix in core Topic list sorting bug Iā€™ve verified that the sorting does work correctly in core now.

1 Like

I have a small feature suggestion.

It would be nice for the admin to be able to apply a thumbnail to a topic without the image being part of the post. Providing a URL for a thumbnail image to appear on the topic list would be a great option for admin created meta topics where youā€™re going to use the same thumbnail/icon for many topics.

For example, when creating a post that explains how to use a category, I have created ā€œ?ā€ question mark ā€˜iconsā€™/images to apply to this post so it fits in with the content around it.

At the moment I have to upload the same image for each post that I create.

2 Likes

Also noticed that thumbnails arenā€™t resized/cropped on mobile view.

1 Like

Not sure what you mean, but feel free to go to town with your own CSS.

There is already the option of a fallback image.

1 Like

This would apply to to every post without an image. Iā€™m talking about re-using an image for multiple (specific) posts. Iā€™m in the middle of a site migration, but once Iā€™m done setting everything up Iā€™ll post a screenshot here of what I mean.

1 Like

It already does apply to every Topic without an image

1 Like

Images are their original aspect ratio on mobile for me. Itā€™s throwing off the layout. On desktop everything looks great.

So fix it with CSS :slight_smile: Something like max-width or however you prefer it.

Or use ā€˜Tilesā€™ on mobile which guarantees respect of aspect ratio without throwing out any formatting.

Letā€™s start again.

When selecting a thumbnail for the post, I want the option of providing a URL of an image. This will allow me to re-use an image of my choice for specific admin created posts, like ā€˜How toā€™ topics or ā€˜Category guidelinesā€™ etc.

I realise there is the ā€˜missing imageā€™ image that is applied to every post without an image, but thatā€™s not what Iā€™m after.

Perhaps what Iā€™m asking for is beyond the scope of this plugin, but it feels like a fairly simple addition to what is a great plugin.

2 Likes

Ah I see, got you.

Yes, unfortunately the raw data has to be either:

  1. within a setting
  2. within the raw post

Thatā€™s mainly to avoid having to change the back end too much and to make the Theme Component a viable alternative to the plugin which has no access to change the back end.

Iā€™m not sure if youā€™ve misunderstood me here or not. What Iā€™m talking about appears to be a genuine bug in the plugin. Asking people to override it with CSS is the wrong approach.

The thumbnails on topic lists, on mobile, are not sized correctly yet they are on desktop. It feels like they probably should be on mobile too. I donā€™t mind getting my hands dirty to fix this if I have to, but I thought Iā€™d raise it as a bug first, itā€™s probably a simple fix for the plugin author.

Ah, Iā€™m forgetting itā€™s a component. I understand why this wouldnā€™t be a simple addition now. Thanks, Iā€™ll have to add the image to each post for now.

1 Like

There is a plugin version. But Iā€™m trying to keep the differences between the two minimal and not to have to store additional data than is there already by virtue of what gets stored in Discourse anyway.

Discourse used to save the image as an ā€˜image_urlā€™ and we might have been able to leverage that in the past, but recently Discourse has taken over thumbnailing logic and the image is referenced as an id. Itā€™s not completely impossible to build this, but not a priority for the free software.

2 Likes

Iā€™m confusing myself now :laughing:

It is actually the plugin I have installed. In which case a custom field could be added to the topic or post to achieve this I think. But Iā€™ve not looked at the latest Discourse code to know whether that would still be the preferred way of doing it.

Completely fair enough. I will need to look at adding it myself if I want it that badly. Thanks

1 Like

Yeah, perhaps the settings could be improved to give more simple flexibility out of the box, but itā€™s generally assumed you can modify the presentation of the thumbnails to your own taste with CSS. Perhaps a mobile setting independent of the desktop setting would be enough but the problem with fixed width and height settings is that it messes up image aspect ratio, then you have to consider cropping etc. so you end up with a can of worms of settings so complex you might as well leave it to CSS?

1 Like

I guess this is where Iā€™m confused, because it seems to crop the images just fine for me on desktop with a fixed width and height. Is there a reason this canā€™t be done on mobile?

Have you set the height to zero?

Width and height were both set to 100.

Upon changing height to 0, desktop then looked like mobile. So it sounds like mobile isnā€™t picking up that height setting because it preserved aspect ratio even when height was set above 0.

2 Likes