本文整理汇总了PHP中get_avatar_filename函数的典型用法代码示例。如果您正苦于以下问题:PHP get_avatar_filename函数的具体用法?PHP get_avatar_filename怎么用?PHP get_avatar_filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_avatar_filename函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_correct_avatar
/**
* Changes a group avatar's filename to conform to the naming scheme
*/
function group_correct_avatar($group_id, $old_entry)
{
global $config, $db, $phpbb_root_path;
$group_id = (int) $group_id;
$ext = substr(strrchr($old_entry, '.'), 1);
$old_filename = get_avatar_filename($old_entry);
$new_filename = $config['avatar_salt'] . "_g{$group_id}.{$ext}";
$new_entry = 'g' . $group_id . '_' . substr(time(), -5) . ".{$ext}";
$avatar_path = $phpbb_root_path . $config['avatar_path'];
if (@rename($avatar_path . '/' . $old_filename, $avatar_path . '/' . $new_filename)) {
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_avatar = \'' . $db->sql_escape($new_entry) . "'\n\t\t\tWHERE group_id = {$group_id}";
$db->sql_query($sql);
}
}
示例2: eveapi_getPortrait
/**
* Downloads the character portrait from EVE as the new user's avatar.
* @param mixed $id The ID of the character whose portrait is being retrieved.
* @param int $user_id User ID of the account to apply the avatar to. Optional. Used during registration.
* @return filename for the newly downloaded avatar.
*/
function eveapi_getPortrait($id, $user_id = false)
{
global $config, $user, $phpbb_root_path;
$user_id = $user_id ? $user_id : $user->data['user_id'];
$input = 'http://image.eveonline.com/Character/' . $id . '_256.jpg';
$db_filename = $user_id . "_" . time() . ".jpg";
$filename = get_avatar_filename($db_filename);
$output = !defined('ADMIN_START') ? $config['avatar_path'] . "/" . $filename : $phpbb_root_path . $config['avatar_path'] . "/" . $filename;
$fgc = curl_file_get_contents($input);
if (!$fgc) {
return false;
}
if (file_exists($output)) {
unlink($output);
}
file_put_contents($output, $fgc);
return $db_filename;
}
示例3: get_avatar_real_filename
public function get_avatar_real_filename($user_avatar)
{
global $phpbb_root_path, $phpEx, $db, $config, $user, $auth, $cache, $template;
$this->init(false);
require_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$rv = null;
if (isset($user_avatar) && strlen($user_avatar)) {
$rv = get_avatar_filename($user_avatar);
}
return $rv;
}