Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: pict-rs transformations don't apply to proxied images #4893

Closed
5 tasks done
Xyphyn opened this issue Jul 8, 2024 · 5 comments · Fixed by #4895
Closed
5 tasks done

[Bug]: pict-rs transformations don't apply to proxied images #4893

Xyphyn opened this issue Jul 8, 2024 · 5 comments · Fixed by #4895
Labels
bug Something isn't working

Comments

@Xyphyn
Copy link

Xyphyn commented Jul 8, 2024

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.
  • Do you agree to follow the rules in our Code of Conduct?
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

I'm unsure if this is a pict-rs issue or a Lemmy issue, but looking at pict-rs's API, I think it's more likely to be Lemmy.

Many clients use pict-rs image transformations to load images more efficiently, such as thumbnail and format. Recently, as I was testing performance of my app, I noticed images were taking a ridiculous amount of bandwidth. Looking into it, images via /image_proxy were being loaded at their full size, regardless of these arguments.

This is not good for bandwidth, as this 24px avatar is being loaded in 4K.

image

These arguments still work fine for non proxied images, and before 0.19.4.

Steps to Reproduce

  1. Fetch an image via /image_proxy
  2. Add arguments to control image size/format, such as ?thumbnail=256&format=webp
  3. Observe how the received image ignores those arguments.

Technical Details

The solution to this is likely to pass these parameters to pict-rs.

Version

0.19.5

Lemmy Instance URL

lemm.ee

@Xyphyn Xyphyn added the bug Something isn't working label Jul 8, 2024
@dessalines
Copy link
Member

dessalines commented Jul 9, 2024

Could you link the post / profile example? I'm pretty sure pictrs supports this and might just be an issue with lemmy-ui.

@Xyphyn
Copy link
Author

Xyphyn commented Jul 9, 2024

Here's one image:

https://lemm.ee/api/v3/image_proxy?url=https%3A%2F%2Fmander.xyz%2Fpictrs%2Fimage%2Fdbeda0de-d3fb-4fab-8703-3e52e72cb4db.jpeg&format=webp&thumbnail=48

Notice how format is set to webp and thumbnail is 48, but it still loads the full image. Lemmy-ui doesn't use these afaik (if recommend it should!), so this issue doesn't completely apply there.

Every proxied image has this issue.

@dessalines
Copy link
Member

@asonix is there a way to do image processing on these proxied image urls?

@Nutomic
Copy link
Member

Nutomic commented Jul 9, 2024

It seems like we need to request proxied images via /image/process if there are any parameters. Basically the same logic as here.

Screenshot_20240709_175913

@dessalines
Copy link
Member

K, I'll get this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants