Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: control over fallback order #9

Open
iainhallam opened this issue Jan 15, 2022 · 0 comments
Open

Feature: control over fallback order #9

iainhallam opened this issue Jan 15, 2022 · 0 comments

Comments

@iainhallam
Copy link

(Taken from the discussion at https://www.dokuwiki.org/plugin:avatar)

"Right now it seems that the order is Look for the avatar fileGenerate the monster ID (via gravatar)Use the default images (via gravatar)Get the gravatar. I don't want gravatar to see the image requests, but I'm sure that some people don't mind/care - to each his own. So, two things: don't talk to gravatar if you don't need to, and I'd like to be able to swap the fallback order in the config menu.

"Here is how I would do it in skeleton code:-

$fallbacks   = explode( ',', $this->getConf( 'fallback' ) );
$fallbacks[] = 'default';  // Make sure that there is a successful case
 
$src = false;
foreach ( $fallbacks as $fb )
{
    switch ( trim($fb) )
    {
        case 'localimage':
            // check first if a local image for the given user exists
            break;
 
        case 'monsterid':
            // build the URL for the local monster id
            break;
 
        case 'gravatar':
            // build the URL for the gravatar
            break;
 
        case 'default':
        default:
            // fall back to the fixed image sizes
    }
 
    if ( $src !== false )
        break;
}

"Hence, I can get what I achieve by setting $conf['fallback'] = 'localimage', and the current way by setting it to localimage,gravatar."

– Andy Turner 2009-07-14 15:10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant