fix(telegram): fallback to document when photo dimensions exceed limits#15728
Closed
ee-blog wants to merge 1 commit into
Closed
fix(telegram): fallback to document when photo dimensions exceed limits#15728ee-blog wants to merge 1 commit into
ee-blog wants to merge 1 commit into
Conversation
Telegram's send_photo has dimension limits (sum of width+height <= 10000px). When sending large screenshots or tall images, the API returns 'Photo_invalid_dimensions' error. Fix: Catch this specific error in send_image_file() and automatically fallback to send_document() which has no dimension limits (only 50MB size). This is similar to the existing 5MB URL fallback (commit 542faf2) but handles local files with dimension issues instead of URL size issues.
This was referenced Apr 26, 2026
Contributor
|
Salvaged via #19630 onto current main - your commit authorship was preserved. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Telegram's
send_photoAPI has dimension limits — the sum of width + height must not exceed 10000px. When sending large screenshots or tall images (e.g., full-page screenshots), the API returnsPhoto_invalid_dimensionserror.Solution
Catch the
Photo_invalid_dimensionserror insend_image_file()and automatically fallback tosend_document()which:This is similar to the existing 5MB URL fallback (commit 542faf2) but handles local files with dimension issues instead of URL size issues.
Related
Testing
Tested with a full-page screenshot (height > 5000px) that previously failed with
Photo_invalid_dimensions. After this fix, the image was successfully sent as a document file.