|
|
|
|
@ -911,9 +911,11 @@ class GroupPortalManager |
|
|
|
|
default: // Base: empty, the result path below will be relative. |
|
|
|
|
$base = ''; |
|
|
|
|
} |
|
|
|
|
$gravatarEnabled = api_get_configuration_value('gravatar_enabled'); |
|
|
|
|
$noPicturePath = array('dir' => $base.'img/', 'file' => 'unknown.jpg'); |
|
|
|
|
|
|
|
|
|
if (empty($id) || empty($type)) { |
|
|
|
|
return $anonymous ? array('dir' => $base.'img/', 'file' => 'unknown.jpg') : array('dir' => '', 'file' => ''); |
|
|
|
|
if ((empty($id) || empty($type)) && !$gravatarEnabled) { |
|
|
|
|
return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$id = intval($id); |
|
|
|
|
@ -922,8 +924,8 @@ class GroupPortalManager |
|
|
|
|
$sql = "SELECT picture_uri FROM $group_table WHERE id=".$id; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
|
|
|
|
|
if (!Database::num_rows($res)) { |
|
|
|
|
return $anonymous ? array('dir' => $base.'img/', 'file' => 'unknown.jpg') : array('dir' => '', 'file' => ''); |
|
|
|
|
if (!Database::num_rows($res) && !$gravatarEnabled) { |
|
|
|
|
return $anonymous ? $noPicturePath : array('dir' => '', 'file' => ''); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$user = Database::fetch_array($res); |
|
|
|
|
@ -940,9 +942,26 @@ class GroupPortalManager |
|
|
|
|
} else { |
|
|
|
|
$dir = $base.'upload/users/groups/'.$id.'/'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($gravatarEnabled) { |
|
|
|
|
$avatarSize = api_getimagesize($noPicturePath['dir'].$noPicturePath['file']); |
|
|
|
|
$avatarSize = $avatarSize['width'] > $avatarSize['height'] ? |
|
|
|
|
$avatarSize['width'] : |
|
|
|
|
$avatarSize['height']; |
|
|
|
|
return array( |
|
|
|
|
'dir' => '', |
|
|
|
|
'file' => self::getGravatar( |
|
|
|
|
$user['email'], |
|
|
|
|
$avatarSize, |
|
|
|
|
api_get_configuration_value('gravatar_type') |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($picture_filename) && $anonymous) { |
|
|
|
|
return array('dir' => $base.'img/', 'file' => 'unknown.jpg'); |
|
|
|
|
return $noPicturePath; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return array('dir' => $dir, 'file' => $picture_filename); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -981,12 +1000,15 @@ class GroupPortalManager |
|
|
|
|
*/ |
|
|
|
|
public static function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM, $style = '') |
|
|
|
|
{ |
|
|
|
|
$gravatarEnabled = api_get_configuration_value('gravatar_enabled'); |
|
|
|
|
$patch_profile = 'upload/users/groups/'; |
|
|
|
|
$picture = array(); |
|
|
|
|
$picture['style'] = $style; |
|
|
|
|
if ($picture_file == 'unknown.jpg') { |
|
|
|
|
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/'.$picture_file; |
|
|
|
|
return $picture; |
|
|
|
|
if (!$gravatarEnabled) { |
|
|
|
|
return $picture; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch ($size_picture) { |
|
|
|
|
@ -1026,6 +1048,9 @@ class GroupPortalManager |
|
|
|
|
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_group.png'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($gravatarEnabled) { |
|
|
|
|
$picture['file'] = $image_array['file']; |
|
|
|
|
} |
|
|
|
|
return $picture; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|