Changeset 8308c9ca in Klonkt


Ignore:
Timestamp:
06/28/2026 10:27:59 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
318e1ce
Parents:
48027f2
Message:

fix(images): full-width timeline media at 1280px (was 640, blurry on mobile retina)

The News-feed media is full-width — on a phone that's ~430px CSS x 3 DPR ~= 1290 physical px,
so the 640px thumbnail was upscaled and looked low-quality. Serve it at 1280px (crisp on
mobile/desktop retina; capped at the original width). Grid/list covers stay small (their
display is small; a bigger thumb would over-downscale line-art on desktop).

  • services/ThumbnailService.js — add 1280 to the size whitelist
  • views/pages/news.ejs — feed media thumb 640 -> 1280
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/services/ThumbnailService.js

    r48027f2 r8308c9ca  
    2424
    2525// Allowed widths (whitelist → no arbitrary-size abuse). 96 = small feed/comment avatars
    26 // (~44px); 128 = nav/profile avatars; 256 ≈ 2× a list cover; 480 ≈ 2× a grid tile. Keep
    27 // these ~2× the display size so line-art stays crisp (the browser barely downscales).
    28 export const THUMB_SIZES = new Set([96, 128, 256, 320, 480, 640]);
     26// (~44px); 128 = nav/profile avatars; 256 ≈ 2× a list cover; 480 ≈ 2× a grid tile; 1280 =
     27// full-width timeline media (crisp on mobile retina, ~430px × 3 DPR). Keep these ~2× the
     28// display size so the browser barely scales (avoids both jaggies and upscaling blur).
     29export const THUMB_SIZES = new Set([96, 128, 256, 320, 480, 640, 1280]);
    2930
    3031let _seq = 0;
  • src/views/pages/news.ejs

    r48027f2 r8308c9ca  
    118118            <div class="tl-media">
    119119              <% imgs.forEach(function(m){ %>
    120                 <a class="tl-media-img" href="<%= m.url %>" target="_blank" rel="noopener"><img src="<%= thumb(m.url, 640) %>" alt="" loading="lazy" decoding="async"></a>
     120                <a class="tl-media-img" href="<%= m.url %>" target="_blank" rel="noopener"><img src="<%= thumb(m.url, 1280) %>" alt="" loading="lazy" decoding="async"></a>
    121121              <% }); %>
    122122            </div>
Note: See TracChangeset for help on using the changeset viewer.