private Element loadAvatarFromDatabase(String username) {
        Element vcardElement = defaultProvider.loadVCard(username);
        Element avatarElement = null;
        if (vcardElement != null && vcardElement.element("PHOTO") != null) {
            avatarElement = vcardElement.element("PHOTO").createCopy();
        }
        return avatarElement;
    }
Loads the avatar element from the user's DB stored vcard.

@param username User whose vcard/avatar element we are loading.
@return Loaded avatar element or null if not found.
xmppserver/src/main/java/org/jivesoftware/openfire/ldap/LdapVCardProvider.java