Answer the question
In order to leave comments, you need to log in
How to determine that the user has not uploaded a picture to the social network?
I am doing authorization through vk and fb ..
Friends, tell me, please, how can I initialize that the user has not uploaded a picture on vk and facebook? (there is a default picture of the social network)
Thanks in advance ..
Answer the question
In order to leave comments, you need to log in
Vkontakte:
vk.com/dev/users.get
vk.com/dev/fields
photo_50 url of a user's square photo that is 50 pixels wide. If the user does not have a photo, vk.com/images/camera_c.gif is returned.
the string
photo_100 is the url of the user's square photo, which is 100 pixels wide. If the user does not have a photo, vk.com/images/camera_b.gif is returned.
the string
photo_200_orig is the url of the user's photo, which is 200 pixels wide. If the user does not have a photo, vk.com/images/camera_a.gif is returned.
the string
photo_200 is the url of the user's square photo, which is 200 pixels wide. If the photo was uploaded a long time ago, there may not be an image with such dimensions, in which case the response will not contain this field.
the string
photo_400_orig is the url of the user's photo, which is 400 pixels wide. If the user does not have a photo of this size, the response will not contain this field.
the string
photo_max url of the user's square photo with the maximum width. A photo having a width of either 200 or 100 pixels can be returned. If the user does not have a photo, vk.com/images/camera_b.gif is returned.
string
photo_max_orig url of the user's photo of the maximum size. A photo having a width of either 400 or 200 pixels can be returned. If the user does not have a photo, vk.com/images/camera_a.gif is returned.
line
1. If the user has an avatar loaded:
The user "Bakha Rustamov" has an avatar loaded vk.com/id220353117
2. If the user has no avatar loaded:
The user "Bakha Rustamov" has no avatar loaded vk.com/id220353117
<?php
$uid = '220353117';
$userGet = file_get_contents("https://api.vk.com/method/users.get?fields=photo_50&uid=".$uid);
$json_user = json_decode($userGet,1);
$uid = $json_user["response"][0]["uid"];
$photo_50 = $json_user["response"][0]["photo_50"];
$last_name = $json_user["response"][0]["first_name"].' '.$json_user["response"][0]["last_name"];
if($photo_50 != 'http://vk.com/images/camera_50.png') {
Echo"У пользователя «".$last_name."» <b>загружна</b> аватарка vk.com/id".$uid;
} else {
Echo"У пользователя «".$last_name."» <b>НЕ загружна</b> аватарка vk.com/id".$uid;
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question