-
-
Notifications
You must be signed in to change notification settings - Fork 920
Description
Requirements
- Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
- Did you check to see if this issue already exists?
- Is this only a single bug? Do not put multiple bugs in one issue.
- Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
While looking at the code for generating link metadata I noticed a major problem with the way thumbnails are generated: In this line images are fetched using pictrs endpoint GET /image/download which stores the full size image in pictrs. This same fullsize image is then returned as "thumbnail", there is no resizing done at all. To confirm this I looked at some API responses from lemmy.ml, and in fact post.url and post.thumbnail_url always point to an identical image with the exact same dimensions (sometimes over 1000px). Thumbnails are also generated whenever a remote post is received, so even an instance with no local user activity will quickly grow in storage size.
To resolve this I think pictrs should add an option like GET /image/download?resize={pixels}. If an image is larger than this, it should be downscaled before storing, and the full sized image discarded. It would also be good if we could test image functionality as part of api tests to ensure that thumbnails are always below a certain size.