Images shrink and look distorted in featured posts

Hi everyone!

We have several featured posts, and images look somewhat terrible there:

Is there a way to resize images without losing quality?

Just in case, here’s our forum: https://community.elfsight.com/

Thanks!

2 Likes

Is that from the Featured Cards component? If so, maybe @nolo can help?

4 Likes

Yeah that looks like the component. Though it’s based on the Featured Tiles component and I believe with regards to image resizing I didn’t change any code. I also sometimes see blurry previews with the Topic List Thumbnails component. Maybe @david has advice how to optimize images so the previews don’t get blurred?

3 Likes

You need to update the size definitions here:

And then do the maths to update the list of required resolutions here:

4 Likes

Oh… thanks for pointing this out! I let users adjust the sizes in settings:

Screenshot from 2022-05-16 12-55-03

Looks like I’ll have to think a bit if and how I can integrate this flexibility with the existing definitions :robot:

3 Likes

The easiest approach is probably to define the component with the the largest reasonable size in the code (maybe 500x500, plus the 1.5x and 2x variants), and then let the browser resize them down when displaying?

3 Likes

Thanks for the hint David! This seems pretty straightforward for the component. In any case, looks like I’ll need to understand a bit better what the browsers are actually doing, picking a scaled thumbnail and resizing it to the final layout size. As mentioned, I also saw blurry images with the topic list thumbnails and the results are slightly different depending on browser. And it’s probably because I do some size adjustments on my theme code.