使用getUserPhotos的电报照片格式

时间:2017-04-11 13:18:30

标签: api telegram

我使用getUserPhotos来获取个人资料照片。我应该为html src属性使用的主要标准来源是什么? (我甚至在电报的文档中搜索过,但没有得到解决方案。)

我的部分结果(类型为photos.Photos):

Array
(
    [_] => photos.photosSlice
    [count] => 14
    [photos] => Array
        (
            [0] => Array
                (
                    [_] => photo
                    [has_stickers] => 
                    [id] => 195744071274310414
                    [access_hash] => -5116812755800708610
                    [date] => 1472714208
                    [sizes] => Array
                        (
                            [0] => Array
                                (
                                    [_] => photoSize
                                    [type] => a
                                    [location] => Array
                                        (
                                            [_] => fileLocation
                                            [dc_id] => 4
                                            [volume_id] => 425426808
                                            [local_id] => 100105
                                            [secret] => -7781982930425156181
                                        )

                                    [w] => 160
                                    [h] => 160
                                    [size] => 11694
                                )
...

1 个答案:

答案 0 :(得分:1)

您需要做的是使用以下方法下载文件或图片:

upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File;

下面定义了InputFileLocation,并且可以在上述问题中从PhotoSize.location获取:

inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation;

有关文件下载的详细信息,请访问:https://core.telegram.org/api/files#downloading-files