How do we fetch a square FB image and not just the "large" image?

Currently, we have set "Yes, use large avatars from social networks if available" on the WP plugin. However, how would we force Oneall to fetch square images from Facebook?

So currently it will display an image like this: https://graph.facebook.com/xxxxxx/picture?type=large, however I would like to change that to force a square - which would be something like: https://graph.facebook.com/xxxxxxx/picture?width=200&height=200

Is this even possible with oneall?

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    Hi,
    One way to do this is to use one of the plugin's hook to change the image URL.
    You can add code like this to the theme's functions.php file:
    function edit_picture_url ($userdata, $profile, $redirect) { if (strtolower ($profile->source->name) == 'facebook') { $picture = str_replace ('?type=large', '?width=200&height=200', get_user_meta ($userdata->ID, 'oa_social_login_user_picture', true)); update_user_meta ($userdata->ID, 'oa_social_login_user_picture', $picture); error_log ('Modified: '. $picture .', '. $thumbnail .' -- EDIT_PICTURE_URL'); } } add_action('oa_social_login_action_before_user_redirect', 'edit_picture_url', 10, 3);You can change the 200 values to something else.
    Hope this helps.

Answers

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.