Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Bugfix - Facebook user images lose aspect ratio due to incorrect API call

edited November 2015 in Vanilla 2.0 - 2.8

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:
image

width=200&height=200:
image

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");

Tagged:

Comments

Sign In or Register to comment.