openvibers/openvibe.shared Commits

Shared 4.1.9: avatars are asked for in the size they are shown (Media's /o/:id?w=&fmt=) (#77)

OP OpenVibers committed 29 days ago · tag v4.1.9 · 0 files, +0 −0

**Avatars are asked for in the size they are shown (openvibe-shared 4.1.9).**

**Why:** the navbar and the footer load a person's picture at full size. One sampled avatar is a 162 × 152 PNG of 18.6 KB, shown 32 px wide in the navbar and 24 px in the footer. Media's thumbnail variants (Media#118, Fabric F4), followed by the object route, resize a public image object on request and cache the result. At 96 px as WebP that avatar is 606 bytes.

**Change:**
- **`navbar.js` `avatarSrc(user, size)`:** an `https://openvibe.media/o/med_…` picture becomes `?w=<size>&fmt=webp`. The sizes are 64 for the chip, 72 for the menu and 48 for the account switcher, already twice the shown size. Any other address is used as it is. The code is compact to keep `navbar.js` under its 30 KB brotli budget (30,696 bytes).
- **`footer.js`:** the 24 px signed-in avatar asks for 64 px.

Until Media serves object variants, it ignores the query and answers the original.

**Test:** `navbar-auth.test.js` signs in with an object avatar (the chip's `src` carries `?w=64&fmt=webp`) and with a `/f/` file (unchanged). It also checks that the footer sizes an object avatar. The suite passes (58 of 59 files; floating-promises skips without acorn).

This commit has no diff to show.