Skip to content

Feature: control over fallback order #9

@iainhallam

Description

@iainhallam

(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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions