Support » Plugin: Social Login » Need bigger avatar size

  • Resolved jstneti

    (@jstneti)


    Hi there,

    First of all, thank you for such a great plugin.

    But we have a problem where we show avatars as square 85×85 px images and they are blurry.
    Your plugin saves the FB image link with /picture?type=square in the DB. Is there any filter this could be changed to /picture?width=150&height=150 ?

    The linked in images are of size 80 x 80, but I’m not sure this can be changed that easily. Can it?

    Thanks in advance,
    Vale

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Claude

    (@claudeschlesser)

    Hello,

    please try this:

    – Open the social login settings in your WordPress admin area.
    – Look for “If the user’s social network profile has an avatar, should this avatar be used as default avatar for the user?”
    – Set to “Yes, use large avatars from social networks if available”.

    Maybe this already fixes the issue.

    • This reply was modified 2 years, 5 months ago by Claude.

    Hi Claude,

    Thanks for the answer, but that doesn’t really halp as I need square images.
    In the DB I have the suared 50px image and the large (not suared) images. But I would like to store images of size 150×150 with the parameter width=150&height=150.

    So is there a filter I could use for that? Or would I just have to filter the get_avatar function to strip the squared parameter and add the desired one?

    And I see that linkedin does it similarly with https://media.licdn.com/mpr/mpr/shrinknp_100_100/….jpg

    Plugin Author Claude

    (@claudeschlesser)

    Hello,

    I have made a couple of tests and you can simple add the width=150&height=150 parameters to the picture URLs saved by the plugin (…/picture?type=square)

    .../picture?type=square => .../picture?type=square&width=150&height=150

    This will automatically return the image in the specified size.

    😉

    • This reply was modified 2 years, 4 months ago by Claude.
    Plugin Author Claude

    (@claudeschlesser)

    Something like this should do the trick:

    function oa_social_login_image_size ($null, $object_id, $meta_key, $meta_value, $prev_value)
    {
    	if ($meta_key == 'oa_social_login_user_thumbnail') // or oa_social_login_user_picture
    	{
    		if (strpos ($meta_value, 'facebook') !== false && strpos ($meta_value, '150') === false)
    		{
    			update_user_meta ($object_id, 'oa_social_login_user_thumbnail', $meta_value.'&height=150&width=150');
    			return true;
    		}
    	}
    	return null;
    }
    
    add_filter( 'update_user_metadata', 'oa_social_login_image_size', 10, 5 );

    I haven’t tested the code, so please check before using it 😉

    Hi Claude,

    Thanks for the answer.

    I ended up using the get_avatar filter that I have to use anyways because we also use a plugin to upload a custom avatar.
    I get the URL anyways then I just have to check if ‘oa_social_login_identity_provider’ equals ‘Facebook’ and add the params at the end.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need bigger avatar size’ is closed to new replies.