E
E
Eugene2017-02-14 11:21:16
In contact with
Eugene, 2017-02-14 11:21:16

Photos are not selectively uploaded to the Vkontakte server, possible reasons?

Help with a problem when uploading photos to Vkontakte servers. For some reason, some of the photos are not saved. When uploading to the server in contact, I get the answer:

Array
(
    [server] => 638819
    [photos_list] => [{"photo":"fe0f4a4682:w","sizes":,"kid":"98fbf90466a296a446f7156a3693def7","debug":"xswmwxwywzwwwowpwqwrw"}]
    [aid] => 265057844
    [hash] => a04973efcac15b4ef8a2a558a83e6993
    [gid] => 126766723
)

The answer is correct as far as I know. Next, I save the photo using the photos.save method:
$params = [
'group_id'=>$group_id,
'album_id'=>$album_id,
'server'=> $response['server'],
'photos_list'=>$response['photos_list'],
'hash'=>$response['hash'],
'caption'=>$product['url'].$product['title'].'Цена: '.$product['price'].' руб.'.PHP_EOL.$product['description'].$product['size'].$product['material'].$product['brand'].$product['code'],
'access_token'=>$access_token,
'v'=>$v,
];
$vk_method = 'photos.save';
$url = $vk_url.$vk_method.'?'.http_build_query($params);

$response = json_decode(file_get_contents($url),true);

This gives me a warning:
Warning: file_get_contents(https://api.vk.com/method/photos.save?group_id=125769423&album_id=235078544&server=638819&photos_list=%5B%7B%22photo%22%3A%22fe0f4a4682%3Aw%22%2C%22sizes%22%3A%5B%5B%22s%22%2C%22638819746%22%2C%22b57a%22%2C%22qxwzlvwGSmg%22%2C56%2C75%5D%2C%5B%22m%22%2C%22638819746%22%2C%22b57b%22%2C%22PATwD_niuUM%22%2C97%2C130%5D%2C%5B%22x%22%2C%22638819746%22%2C%22b57c%22%2C%22jxVeU0SLH6I%22%2C453%2C604%5D%2C%5B%22y%22%2C%22638819746%22%2C%22b57d%22%2C%22nvpTMD4qgOQ%22%2C605%2C807%5D%2C%5B%22z%22%2C%22638819746%22%2C%22b57e%22%2C%22bP5SsUTcwuc%22%2C810%2C1080%5D%2C%5B%22w%22%2C%22638819746%22%2C%22b57f%22%2C%22XX9jFzb_y0Y%22%2C900%2C1200%5D%2C%5B%22o%22%2C%22638819746%22%2C%22b580%22%2C%22Ob6onuUREpI%22%2C130%2C173%5D%2C%5B%22p%22%2C%22638819746%22%2C%22b581%22%2C%22EdcoeN4JfR0%22%2C200%2C267%5D%2C%5B%22q%22%2C%22638819746%22%2C%22b582%22%2C%22YpsE7a65V7g%22%2C320%2C427%5D%2C%5B%22r%22%2C%22638819746%22%2C%22b583%22%2C%22Y7B-7yBibu0%22%2C510%2C680%5D%5D%2C%22kid%22%3A%2298fbf90466a296a446f7156a3 in D:\OpenServer\domains\localhost\savephotos2.php on line 75

This returns an empty result and no photos appear in the group's album. Instead of file_get_contents, I tried to pass it with a curl, it does not display errors, but it also does not save anything.
Since the uploaded catalog is small, after analyzing the upload, I determined that the same photos are not saved (out of 344, 99 are not saved). For example, a photo in red is not saved, but a photo in black is saved. Photos from the same site are identical in size, what is wrong with the photo in red, why is it not saved, while, as I understand it, it went successfully to the server in contact?
Tried changing the size, resolution of the photo - does not help.
7705d21d0f584d13a19e418985d0cb3f.jpg2f435fd3a55648f39605994c932cc43d.jpg
1) If the photo matches all the parameters set out in the documentation, then what could be the reasons for refusing to upload? In my opinion, the matter is in the photo itself, since the same ones are not loaded.
2) And another question about uploading photos to an album: the Vkontakte API provides for uploading no more than 5 photos at a time, while saving photos in an album by calling the photos.save method provides one caption text parameter, i.e. As far as I understand from the documentation, if five photos are uploaded at the same time, will everyone have the same comment?
Is it possible to somehow transfer five different captions, each photo has its own?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question