1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Other [PAID] PHP script to display an avatar via URL

Discussion in 'Resource and Add-on Requests' started by Brentnauer, Apr 21, 2012.

  1. Brentnauer

    Brentnauer Well-Known Member

    Here's what I'm trying to accomplish:

    Basically, I need to be able to do this:
    <img src="http://mysite.com/avatar.php?uid=1&size=s" />
    <img src="http://mysite.com/avatar.php?user=Cosmo&size=s"/>
    And have it display this:

    The script would need to be able to provide the ability to display the appropriate size depending on the string in the URL; small, medium or large.

    The script should also be able to display Gravatars if they're being used, or a fallback image if no avatar exists.

    Jake Bunce probably already got me halfway with this post, but I'm not familiar enough with any of this to work it out myself in a reasonable amount of time.

    Willing to throw a few bucks at this via PayPal if anyone is interested. I also won't mind sharing the file so others can benefit, if that makes a difference.

  2. EasyTarget

    EasyTarget Well-Known Member

    I am trying to figure out what you are trying to do, where do you want to display the avatar? Inside a post?
  3. Brentnauer

    Brentnauer Well-Known Member

    I'm going to use it to display user avatars in AddonChat. The message template right now is:
    <table border=0 cellpadding=0 cellspacing=3><tr><td valign=top align=left>$avatar</td><td align=left valign=top>$time $username:<br>$message</td></tr></table>
    The $avatar bit just calls AddonChat's own crappy avatars. What I want to do is replace that with:
    <img src="http://mydomain.com/avatar.php?uid=$uid&size=s" />
    so that it shows user avatars from my site.

    What I need is the avatar.php script written by someone so it can produce the image. Since AddonChat can't hook in to xenForo's logic/mechanics, this is the only way I found that will work.

    Hopefully that makes sense, let me know if I'm explaining it poorly.
  4. Brentnauer

    Brentnauer Well-Known Member

  5. Brentnauer

    Brentnauer Well-Known Member

  6. Sadik B

    Sadik B Well-Known Member

    You need your software, whatever it is, to initialize xenforo and then you can use the code which Jake pointed you to. But ya, you will probably need someone with experience if you haven't done it before.
  7. Brentnauer

    Brentnauer Well-Known Member

    Addonchat has no way of doing this; the only thing you can edit inside Addonchat's templates is the HTML used to display the chat message. The script inside the image tag needs to initialize xenForo.
  8. Tilkißey

    Tilkißey Well-Known Member

    i dont have any knowledge about addonchat but if you want show XenForo's users' avatar (which is local or gravatar) via using another page, i can write it (just using userId)
    please send me pm for demo file if u interested
  9. Naatan

    Naatan Well-Known Member

    class Misc_Avatar
        public function 
    actionIndex($username$size 'm')
    $user        XenForo_Model::create('XenForo_Model_User');
    $me        $user->getUserByName($username);
    $avatarUrl    XenForo_Template_Helper_Core::callHelper('avatar', array($me$sizenulltrue));
    header("Cache-Control: max-age=7200");
    header("Expires: \"".date(DATE_RFC822,strtotime("+2 hours"))."\"");
    header("location: $avatarUrl");
    Just hook this controller up to a prefix and you're done.
  10. Brentnauer

    Brentnauer Well-Known Member

  11. Tilkißey

    Tilkißey Well-Known Member

  12. Floris

    Floris Guest

  13. ragtek

    ragtek Guest

    without avatar it's already available in vanilla xenforo http://xenforo.com/community/members/ragtek.82/ministats.xml

    you could include the avatar url too and include it as image on client side
    public function actionMiniStats()
    $userId $this->_input->filterSingle('user_id'XenForo_Input::UINT);
    $user $this->getHelper('UserProfile')->assertUserProfileValidAndViewable($userId);
    $user XenForo_Application::arrayFilterKeys($user, array(
    $viewParams = array('user' => $user);
    1 person likes this.
  14. Liam23

    Liam23 Active Member

    Shoot me a PM, If your still interested.

Share This Page