nirvana43
03-31-2012, 11:17 AM
Hello,
When avatars are stored in database, they can be accessed by :
http://website.com/forums/image.php?u=userid
But when the avatars are moved to filesystem, how they can be accessed?
Specially when this is required in 3rd party modifications, how it can be achieved?
Cheers!!
--------------- Added 1333196792 at 1333196792 ---------------
Nevermind.. coded my own solution but if someone knows any better way to do this then please let me know.
Below is the custom function i have coded which can return avatars when they are stored in filesystem instead of database :
//Call below function for every uid
function getUserAvatar($uid = 0)
{
$adiResult = $vbulletin->db->query_read('SELECT avatarrevision from '.TABLE_PREFIX.'user where userid='.$uid);
if($row = $vbulletin->db->fetch_array($adiResult ))
{
if($row['avatarrevision'] === 0)
$adiAvatar = 'images/default_avatar_image.jpg';
else
$adiAvatar = 'customavatars/thumbs/avatar' . $uid . '_' . $row['avatarrevision'] . '.gif';
}
else
$adiAvatar = 'images/default_avatar_image.jpg';
return $adiAvatar;
}
Cheers!!
When avatars are stored in database, they can be accessed by :
http://website.com/forums/image.php?u=userid
But when the avatars are moved to filesystem, how they can be accessed?
Specially when this is required in 3rd party modifications, how it can be achieved?
Cheers!!
--------------- Added 1333196792 at 1333196792 ---------------
Nevermind.. coded my own solution but if someone knows any better way to do this then please let me know.
Below is the custom function i have coded which can return avatars when they are stored in filesystem instead of database :
//Call below function for every uid
function getUserAvatar($uid = 0)
{
$adiResult = $vbulletin->db->query_read('SELECT avatarrevision from '.TABLE_PREFIX.'user where userid='.$uid);
if($row = $vbulletin->db->fetch_array($adiResult ))
{
if($row['avatarrevision'] === 0)
$adiAvatar = 'images/default_avatar_image.jpg';
else
$adiAvatar = 'customavatars/thumbs/avatar' . $uid . '_' . $row['avatarrevision'] . '.gif';
}
else
$adiAvatar = 'images/default_avatar_image.jpg';
return $adiAvatar;
}
Cheers!!