CatCatNya / catstodon

The Fediverse server that meows at you - a fork of glitch-soc Mastodon
https://git.kescher.at/CatCatNya/catstodon
GNU Affero General Public License v3.0
17 stars 3 forks source link

Compress image previews for the user. #7

Open GamePlayer-8 opened 5 months ago

GamePlayer-8 commented 5 months ago

Steps to reproduce the problem

  1. Open Home / Public timeline / etc. feed while using mobile network.
  2. Wait for some big image to appear.
  3. Bandwidth will struggle.

Expected behaviour

Server should deliver a scalled image preview to the user.

Actual behaviour

Server delivers a non-scalled image preview to the user.

Detailed description

Heya,

I've got a problem with timelines while using a mobile network. My connection is shattering while trying to load some high-quality image previews, making the image preview fail to load at all. Typical wait time for i.e. 4k image is in my case 40s~.

Possible solution: Making the backend deliver a scalled image preview to the end user (possibly based on client viewport size?) in an jpg / jpeg-xl format (compression reasons). User would have an option to get the original file size after pressing onto the image.

Mastodon instance

catcatnya.com

Mastodon version

v4.3.0-alpha.3+glitch+cat+1.0.9

Browser name and version

LibreWolf Firefox 123.0-1 / Firefox Nightly 124.0a1 for Android

Operating system

Artix Linux Rolling / Android 10

Technical details

No response

kescherCode commented 4 months ago

Hm, this should already be the case. After all, Mastodon does make small and large thumbnails for everything.

GamePlayer-8 commented 4 months ago

Sometimes I'm receiving a full size image instead of a compressed one.

The typical errors what I'm receiving during the bad internet speed is:

Failed to load ‘https://cdn.catcatnya.com/cache/media_attachments/files/xxx/xxx/xxx/xxx/xxx/xxx/original/example.jpeg’. A ServiceWorker intercepted the request and encountered an unexpected error. sw.js:1:89315