如何从电报中获取真实尺寸(不是拇指)的照片?
How to get photo in real size (not thumb) from telegram?
我正在使用 getFile() 然后使用 link 下载照片 https://api.telegram.org/file/bot<token>/<file_path>.
但是我只收到了他的缩略图
谁能问我如何下载真实尺寸的照片?
您从 Telegram 收到的 photo
对象包含一个具有不同大小 file_id
的数组。指数越高,尺寸越大,所以你只需要选择合适的file_id
.
它可能看起来像这样:
[{
"file_id":"AgADBAADxxxx",
"file_size":19374,
"width":253,
"height":320
},{
"file_id":"AgADBAACxxxx",
"file_size":75657,
"width":632,
"height":800
}]
如果你使用PHP:你可以写下这行全尺寸:
$file_id = $updates['message']['photo'][1]['file_id'];
拇指这一行:
$file_id = $updates['message']['photo'][0]['file_id'];
我正在使用 getFile() 然后使用 link 下载照片 https://api.telegram.org/file/bot<token>/<file_path>.
但是我只收到了他的缩略图
谁能问我如何下载真实尺寸的照片?
您从 Telegram 收到的 photo
对象包含一个具有不同大小 file_id
的数组。指数越高,尺寸越大,所以你只需要选择合适的file_id
.
它可能看起来像这样:
[{
"file_id":"AgADBAADxxxx",
"file_size":19374,
"width":253,
"height":320
},{
"file_id":"AgADBAACxxxx",
"file_size":75657,
"width":632,
"height":800
}]
如果你使用PHP:你可以写下这行全尺寸:
$file_id = $updates['message']['photo'][1]['file_id'];
拇指这一行:
$file_id = $updates['message']['photo'][0]['file_id'];