Skip to content

Conversation

@composingliger
Copy link

@composingliger composingliger commented Aug 26, 2022

By default Twitter presents images at "medium" size, but it is possible to obtain a higher quality "original" with the :orig name.

Note: Twitter will resize the image at upload time so that no one edge is greater than 4096 px.

It looks like Syfaro/tgbotapi-rs@3bdfa35 caused one of the unit tests to start failing, so committed a fix.

By default Twitter presents images at "medium" size, but it is possible
to obtain a higher quality "original" with the `:orig` name.

Note: Twitter will resize the image at upload time so that no one edge
is greater than 4096 px.
@Syfaro
Copy link
Owner

Syfaro commented Nov 15, 2022

Hey, sorry about taking so long on getting back to this. I like the idea of fetching higher quality images, but from what I've seen, not every image has an orig quality. To ensure that images always work, there'd probably have to be a check first that the file exists. I can probably add that to this PR when I get a chance.

@composingliger
Copy link
Author

composingliger commented Nov 16, 2022

Thanks for the reply! I'd forgotten about this PR.
(And no worries! - I know people get busy with work/life/other stuff)

Interesting. So most new image URLs seem to be dynamic. For example:

Though there seems to be also image URLs that can't be used this way:

(I wish I could find the original Tweet to see what the API returns for "sizes")

I'm not sure the best place to handle this fallback. Might need to do a HEAD request to check it exists?

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

Successfully merging this pull request may close these issues.

2 participants