XF 2.0 Avatar Image Filepath

Blanclour

Member
I've noticed that while XenForo runs an avatar pic through a cropper to get size variants, the original image is still available in a file directory initialed 'o'. By replacing a single character in the image filepath in google I was able to get that source image to display instead of the cropped one. What code do I need to modify or add in order to change the filepath internally so that it uses the 'o' directory instead of the 'l' file directory?
ah1.webpah2.webpah3.webpah4.webp
 
Never Mind, I figured out the php file to modify. For future reference I modified src > XF > entity > User.php

From
Code:
public function getAvatarUrl($sizeCode, $forceType = null, $canonical = false)
    {
        $app = $this->app();

        $sizeMap = $app->container('avatarSizeMap');
        if (!isset($sizeMap[$sizeCode]))
        {
            // Always fallback to 's' in the event of an unknown size (e.g. 'xs', 'xxs' etc.)
            $sizeCode = 's';
        }

        if ($this->app()->options()->gravatarEnable && $this->gravatar && $forceType != 'custom')
        {
            return $this->getGravatarUrl($sizeCode);
        }
        else if ($this->avatar_date)
        {
            $group = floor($this->user_id / 1000);
            return $app->applyExternalDataUrl(
                "avatars/{$sizeCode}/{$group}/{$this->user_id}.jpg?{$this->avatar_date}",
                $canonical
            );
        }
        else
        {
            return null;
        }
    }

Into
Code:
public function getAvatarUrl($sizeCode, $forceType = null, $canonical = false)
    {
        $app = $this->app();

        $sizeMap = $app->container('avatarSizeMap');
        if (!isset($sizeMap[$sizeCode]))
        {
            // Always fallback to 's' in the event of an unknown size (e.g. 'xs', 'xxs' etc.)
            $sizeCode = 's';
        }

        if ($this->app()->options()->gravatarEnable && $this->gravatar && $forceType != 'custom')
        {
            return $this->getGravatarUrl($sizeCode);
        }
        else if ($this->avatar_date)
        {
            if ($sizeCode == 'l' || $sizeCode == 'h')
            {
                $sizeCode = 'o';
            }
            $group = floor($this->user_id / 1000);
            return $app->applyExternalDataUrl(
                "avatars/{$sizeCode}/{$group}/{$this->user_id}.jpg?{$this->avatar_date}",
                $canonical
            );
        }
        else
        {
            return null;
        }
    }
 
Back
Top Bottom