Bugfix - Facebook user images lose aspect ratio due to incorrect API call
As you can see in my profile picture right now, Facebook avatars get distorted when you post, so everyone's face is squishy.
This is because the API call currently being used to get the user image is:
//graph.facebook.com/[userid]/picture?type=large
This returns a rectangular image which is then squished into a square thumbnail on our end, ruining the aspect ratio.
The behavior of type=large is to yield a rectangular image in which the longest dimension is 200px. If what we really want is a square 200x200 image, a slightly different API call will yield that result:
//graph.facebook.com/[userid]/picture?width=200&height=200
This fixes the problem perfectly and yields the desired behavior. For instance, using my profile picture as an example and resizing to square:
type=large:
width=200&height=200:
To make the change on Vanilla 2.2 stable, go to class.facebook.plugin.php and change the following lines
Line 340: 'Photo' => "//graph.facebook.com/{$Profile['id']}/picture?type=large"
Line 531: $Form->setFormValue('Photo', "//graph.facebook.com/{$ID}/picture?type=large");
Comments
I spent some time working through your Github workflow and submitted a PR here: https://github.com/vanilla/vanilla/pull/3319
Hopefully I've submitted the PR correctly!