-1

I am using getFile() and then download photo with a link like https://api.telegram.org/file/bot<token>/<file_path>. But I received only his thumbnails

Can anyone ask me how to download photo in real size?

Dmitry Boytsov
  • 167
  • 1
  • 13

2 Answers2

4

The photo object you receive from Telegram contains an array with the file_id of different sizes. The higher the index, the bigger the size, so you just need to pick the right file_id .

It could look like this:

[{
    "file_id":"AgADBAADxxxx",
    "file_size":19374,
    "width":253,
    "height":320
},{
    "file_id":"AgADBAACxxxx",
    "file_size":75657,
    "width":632,
    "height":800
}]
Maak
  • 4,720
  • 3
  • 28
  • 39
1

if you use PHP: you can write this line for full size:

$file_id = $updates['message']['photo'][1]['file_id'];

and this line for thumb:

$file_id = $updates['message']['photo'][0]['file_id'];

Aml Salman
  • 11
  • 1
  • Actually, there can be more than two sizes. So to get the full size, get the last element of the array, not the second one. – Setop Apr 06 '22 at 20:44