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

with_guessed_format() fails on one machine, but not the other. #2123

Closed
derspyy opened this issue Jan 31, 2024 · 4 comments
Closed

with_guessed_format() fails on one machine, but not the other. #2123

derspyy opened this issue Jan 31, 2024 · 4 comments

Comments

@derspyy
Copy link

derspyy commented Jan 31, 2024

i have this website that gets images from lastfm api and some jpeg images (example:
https://lastfm.freetls.fastly.net/i/u/300x300/902d994170dae8b880c8680f9d3adc6f.jpg)
can't have their formats guessed ("The image format could not be determined")

this is the website for the request: https://piuvas.envs.sh/semaninha/collage?user=andrs-162&size=3&period=1month
my code: https://git.envs.net/piuvas/semaninha/src/commit/77669b6574566c1420738b394e063fc4c1fa7da8/src/main.rs#L65-L67

it works on my arch pc but not on a debian server.

maybe some library issue?

@fintelia
Copy link
Contributor

fintelia commented Feb 1, 2024

The logic for guessing the format isn't very complex. We read the first 16 bytes of the file and then loop over various file prefixes corresponding to different image types. If the file starts with ff d8 ff then it is a JPEG, etc. I'm not sure why that would depend on which OS the code was running on.

Perhaps check whether the first bytes of the file you're passing to guess_format match between the two systems?

@derspyy
Copy link
Author

derspyy commented Feb 1, 2024

will do!

@derspyy
Copy link
Author

derspyy commented Feb 1, 2024

oop. suddenly worked. no clue...

@derspyy derspyy closed this as completed Feb 1, 2024
@derspyy
Copy link
Author

derspyy commented Feb 1, 2024

maybe some issue with their api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants