Note:- I'm not a programmer. The codes from this plugin are collected around the Internet
- The plugin may not be secured
- The plugin may be poorly coded
Features:- Allow members to use a remote image file as their avatar
→ save disk-space and prevent never-come-back members' avatars to be forever stored in the server
- Avatar's height > 70 pixels → set height = 70, else height = avatar's height
- Avatar's filesize > 30KB →
noavatar.png is used
- No link provided →
noavatar.png is used
- Broken link →
noavatar.png is used
- Not an image link →
noavatar.png is used
Installation:1. Open
setup_options.php, add in
$userInfoInPosts:
$dbUserSheme['user_custom2'][1]
Example: $userInfoInPosts=array($dbUserSheme['user_custom2'][1]);
Please change user_costom2 to other field that you use to store avatar link.
Open
bb_plugins.php, add before
?>:
/* Avatar from URL by jontrac */
function parseUserInfo_user_custom2($av){
if($av!='') {
$res = (($ftest = @fopen($av, 'r')) === false) ? false : @fclose($ftest);
if($res == true) {
if (substr($av,0,4)=='http') {
$x = array_change_key_case(get_headers($av, 1),CASE_LOWER);
if ( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) {
$x = $x['content-length'][1];
}
else $x = $x['content-length'];
}
else $x = @filesize($av);
if($x <= 31000 and $size = getimagesize($av)) {
if($size[1] > 70) {
$av='<img src="'.$av.'" height="70" border="0" alt="">';
return $av;
}
else {
$av='<img src="'.$av.'" border="0" alt="">';
return $av;
}
}
else {
$av='<img src="https://www.minibb.com/forums/img/noavatar.png" height="70" border="0" alt="">';
return $av;
}
}
else {
$av='<img src="https://www.minibb.com/forums/img/noavatar.png" height="70" border="0" alt="">';
return $av;
}
}
else {
$av='<img src="https://www.minibb.com/forums/img/noavatar.png" height="70" border="0" alt="">';
return $av;
}
}
/* --Avatar from URL by jontrac */
Open
main_post_cell.html, add in the following code to where you want the avatar to be at:
{$userInfo_user_custom2[$poster_id]}
Open
user_dataform.html, find:
<tr>
<td class="tbClCp">{$l_userInterest}</td>
<td class="caption5"><input type="text" name="interest" maxlength="150" size="20" value="{$interest}" class="textForm" style="width:200px;" /></td>
</tr>
Add bellow:
<!-- Avatar from URL by jontrac -->
<tr>
<td class="tbClCp">Avatar</td>
<td class="caption5">
<input type="text" name="user_custom2" maxlength="100" size="0" value="{$user_custom2}" class="textForm" style="width:317px;" />
<span class="txtSm"><br />URL to avatar | Max filesize: 30 KB</span>
</td>
</tr>
<!-- /Avatar from URL by jontrac-->
Recommendations for code improvements are always welcome!