K
K
Kozlov2019-07-25 18:43:44
PHP
Kozlov, 2019-07-25 18:43:44

How to select biggest photo in vk api photos.get array?

Essence of the question. I get photos in a cycle from the VK album using the photos.get method
There are photos of different sizes (photo_75, photo_130), how to get the largest photo?

{
"response": {
"count": 41,
"items": [{
"id": 247648259,
"album_id": -7,
"owner_id": -1,
"user_id": 100,
"photo_75": "https://pp.userap...1621/s_f15991c2.jpg",
"photo_130": "https://pp.userap...1621/m_4228adaf.jpg",
"photo_604": "https://pp.userap...1621/x_46426f27.jpg",
"text": "",
"date": 1302516221
}, {
"id": 248743686,
"album_id": -7,
"owner_id": -1,
"user_id": 100,
"photo_75": "https://pp.userap...2/-5/s_80529ba4.jpg",
"photo_130": "https://pp.userap...2/-5/m_5fe2d21f.jpg",
"photo_604": "https://pp.userap...2/-5/x_06bffe46.jpg",
"text": "",
"date": 1302712950
}]
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-07-25
@romandkoz

pass the photo_sizes=1 parameter to the method, then the sizes array with photos of different sizes will be returned, respectively, the last element of the array is the largest photo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question