mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-25 14:36:45 +00:00
Fix file.width and .height not working on Photo
This commit is contained in:
parent
ad0307fda6
commit
58013f4f44
@ -69,6 +69,9 @@ class File:
|
|||||||
"""
|
"""
|
||||||
The width in pixels of this media if it's a photo or a video.
|
The width in pixels of this media if it's a photo or a video.
|
||||||
"""
|
"""
|
||||||
|
if isinstance(self.media, types.Photo):
|
||||||
|
return max(getattr(s, 'w', 0) for s in self.media.sizes)
|
||||||
|
|
||||||
return self._from_attr((
|
return self._from_attr((
|
||||||
types.DocumentAttributeImageSize, types.DocumentAttributeVideo), 'w')
|
types.DocumentAttributeImageSize, types.DocumentAttributeVideo), 'w')
|
||||||
|
|
||||||
@ -77,6 +80,9 @@ class File:
|
|||||||
"""
|
"""
|
||||||
The height in pixels of this media if it's a photo or a video.
|
The height in pixels of this media if it's a photo or a video.
|
||||||
"""
|
"""
|
||||||
|
if isinstance(self.media, types.Photo):
|
||||||
|
return max(getattr(s, 'h', 0) for s in self.media.sizes)
|
||||||
|
|
||||||
return self._from_attr((
|
return self._from_attr((
|
||||||
types.DocumentAttributeImageSize, types.DocumentAttributeVideo), 'h')
|
types.DocumentAttributeImageSize, types.DocumentAttributeVideo), 'h')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user