LunarCraft
Member
I am working on a little control panel project for a minecraft server I run, it is hooked into Xenforo for authentication and I figured I'd try to use the avatar of the person logged in.
However I noticed that when using the method getAvatarFilePath($userId, $size) in XenForo_Model_Avatar. I get the local system path.
That of course won't work when I want to output the image in regular html, so if you don't mind me asking, what is the best approach to getting and displaying a users xenforo avatar in a page outside xenforo?
I attempted adding a method to XenForo_Model_Avatar which does what I want, but at the same time I would like to make it work universally without having to modify the class.
Custom method that I want to get rid of in favor of a built-in solution:
I hope some bright person might be able to answer me
However I noticed that when using the method getAvatarFilePath($userId, $size) in XenForo_Model_Avatar. I get the local system path.
That of course won't work when I want to output the image in regular html, so if you don't mind me asking, what is the best approach to getting and displaying a users xenforo avatar in a page outside xenforo?
I attempted adding a method to XenForo_Model_Avatar which does what I want, but at the same time I would like to make it work universally without having to modify the class.
Custom method that I want to get rid of in favor of a built-in solution:
PHP:
public function getAvatarUrl($userId, $size)
{
return sprintf('http://domain/xenforo_installation/data/avatars/%s/%d/%d.jpg',
$size,
floor($userId / 1000),
$userId
);
}