mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Still fine-tuning remote avatar conversion. Prepare to be yelled at.
git-svn-id: file:///svn/phpbb/trunk@7401 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
25219487c6
commit
27daba1df8
1 changed files with 29 additions and 1 deletions
|
@ -912,9 +912,37 @@ function get_remote_avatar_dim($src,$axis)
|
||||||
return $avatar_cache[$src][$axis];
|
return $avatar_cache[$src][$axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$url_info = parse_url($src);
|
||||||
|
$host = $url_info['host'];
|
||||||
|
$port = (isset($url_info['port'])) ? $url_info['port'] : 0;
|
||||||
|
$protocol = $url_info['scheme'];
|
||||||
|
if (empty($port))
|
||||||
|
{
|
||||||
|
switch(strtolower($protocol))
|
||||||
|
{
|
||||||
|
case 'ftp':
|
||||||
|
$port = 21;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'https':
|
||||||
|
$port = 443;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$port = 80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$timeout = @ini_get('default_socket_timeout');
|
$timeout = @ini_get('default_socket_timeout');
|
||||||
@ini_set('default_socket_timeout', 5);
|
@ini_set('default_socket_timeout', 5);
|
||||||
$avatar_cache[$src] = @getimagesize($src);
|
|
||||||
|
// We're just trying to reach the server to avoid timeouts
|
||||||
|
$fp = @fsockopen($host, $port, $errno, $errstr, 3);
|
||||||
|
if ($fp)
|
||||||
|
{
|
||||||
|
$avatar_cache[$src] = @getimagesize($src);
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
$default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
|
$default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
|
||||||
$default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
|
$default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
|
||||||
|
|
Loading…
Add table
Reference in a new issue