avatar

Find Google+ avatar for given email address without OAuth

大城市里の小女人 提交于 2019-11-28 21:26:08
In my app I want to show the Google+ profile picture for a user. The only function, I found, in the API to get the profile picture needs a userId. However, I only have their email adress and not their Google+ userID. Moreover the person, whose image I want to get, should not be forced to log in and authorize my app, as this person is mostly not identical to the user of the app. So I think I need to get their userId by email. I read through the Google+ API documentation but can't find a way to do this, but I can't believe that this is not possible. So my question is: How can I get the Google+

二维数组分组

落花浮王杯 提交于 2019-11-28 19:26:04
1 /** 2 * 二维数组分组 3 * @param [type] $arr [二维数组] 4 * @param [type] $key [键名] 5 * @return [type] [新的二维数组] 6 */ 7 public function arrayGroupBy($arr, $key){ 8 $grouped = array(); 9 foreach ($arr as $value) { 10 $grouped[$value[$key]][] = $value; 11 } 12 if (func_num_args() > 2) { 13 $args = func_get_args(); 14 foreach ($grouped as $key => $value) { 15 $parms = array_merge($value, array_slice($args, 2, func_num_args())); 16 $grouped[$key] = call_user_func_array('array_group_by', $parms); 17 } 18 } 19 return $grouped; 20 } 分组前数据格式: array:5 [ 0 => array:22 [ "name" => "Jackie Ma8" "avatar" => "http:/

Add image/avatar field to users in django

早过忘川 提交于 2019-11-27 10:34:43
I want that each user in my website will have an image in his profile. I don't need any thumbnails or something like that, just picture for each user. The simpler the better. The problem is I don't know how to insert this type of field to my user profile. Any suggestions? Brandon You need to make a form that has a clean method that validates the properties you're looking for: #models.py from django.contrib.auth.models import User class UserProfile(models.Model): user = models.OneToOneField(User) avatar = models.ImageField() #forms.py from django import forms from django.core.files.images