Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 02:44 pm EDT

Geeklog Forums

profile image replacement


Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Applies to Geeklog 1.4:

If you use an image gallery plugin, of which there are a few more choices all of a sudden, and that plugin supports autolinks/autotags then you should be able to use an image from that gallery as your profile image. I mean, why not?!

This is how:
Find the following code in lib-user.php in the function USER_getPhoto().
Text Formatted Code
        if (empty ($photo)) {
            // no photo - try gravatar.com, if allowed
            if ($_CONF['use_gravatar']) {
                $img = 'http://www.gravatar.com/avatar.php?gravatar_id='
                     . md5 ($email);
                if ($width > 0) {
                    $img .= '&size=' . $width;
                }
                if (!empty ($_CONF['gravatar_rating'])) {
                    $img .= '&rating=' . $_CONF['gravatar_rating'];
                }
                if (!empty ($_CONF['default_photo'])) {
                    $img .= '&default='
                         . urlencode ($_CONF['default_photo']);
                }
            }
        } else {

 
and replace it with this slightly expanded version
Text Formatted Code
        if (empty ($photo)) {
            // no photo - try gravatar.com, if allowed
            if ($_CONF['use_gravatar']) {
                $img = 'http://www.gravatar.com/avatar.php?gravatar_id='
                     . md5 ($email);
                if ($width > 0) {
                    $img .= '&size=' . $width;
                }
                if (!empty ($_CONF['gravatar_rating'])) {
                    $img .= '&rating=' . $_CONF['gravatar_rating'];
                }
                if (!empty ($_CONF['default_photo'])) {
                    $img .= '&default='
                         . urlencode ($_CONF['default_photo']);
                }
            } elseif (isset($_CONF['use_gallery'])){
                $photo = PLG_replaceTags($_CONF['use_gallery']);
                return $photo;
            }
        } else {

 

last step:
find this bit in your config.php.
Text Formatted Code
// Use avatars from gravatar.com (if set = true).
// A gravatar will only be requested if there is no uploaded photo.
$_CONF['use_gravatar'] = false;

// gravatar.com provides "movie-style" ratings of the avatars (G, PG, R, X).
// Setting this to 'R' would allow avatars rated as G, PG, and R (but not X).
// $_CONF['gravatar_rating'] = 'R';

// Force a max. width when displaying the user photo (also used for gravatars)
// $_CONF['force_photo_width'] = 75;

// Use this image when there's neither an uploaded photo nor a gravatar.
// Should be the complete URL of the image.
// $_CONF['default_photo'] = 'http://example.com/default.jpg';

 
and replace it with this expanded version.
Text Formatted Code
// Use avatars from gravatar.com (if set = true).
// A gravatar will only be requested if there is no uploaded photo.
$_CONF['use_gravatar'] = false;

// gravatar.com provides "movie-style" ratings of the avatars (G, PG, R, X).
// Setting this to 'R' would allow avatars rated as G, PG, and R (but not X).
// $_CONF['gravatar_rating'] = 'R';

// Force a max. width when displaying the user photo (also used for gravatars)
// $_CONF['force_photo_width'] = 75;

// Use an image provided by image gallery plugins that support autolinks.
// Usually the resulting images include a link to the gallery's larger image.
// $_CONF['use_gravatar'] must be set to false in order to enable this option.
// Inmemoriam Media Gallery syntax: [thumb:1234] where the number represents
// the image ID.
// Media Gallery syntax: [album:12 1234] where the first number is an album ID
// and the 2nd is the image ID.
$_CONF['use_gallery'] = '[thumb:375]';

// Use this image when there's neither an uploaded photo nor a gravatar.
// Should be the complete URL of the image.
// $_CONF['default_photo'] = 'http://example.com/default.jpg';

 

I've included sample syntax for current media plugins that I know support autotags: Inmemoriam Media Gallery and Media Gallery.

works like a charm. enjoy! Chest-Slam Celebration
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
that's the quick and dirty...

If this type of thing was going to be a part of the core then it would be better to leave out the config file and just have an extra text input field in the profile editor that housed the autolink.
etc., etc., Blah Blah Blah Blah ...
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
I guess this is really kind of useless cuz it only allows one image, i.e., the same image for all profiles.
oops Embarassed

no biggy to add a column to the users table and a field to the profile editor/function though. I've just done it and again it works like a charm.
 Quote

All times are EDT. The time is now 02:44 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content