Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Adjust profile image dimensions for Fb and Twitter #382

Merged
merged 1 commit into from
Feb 6, 2015

Conversation

igorauad
Copy link
Contributor

@ilanbiala please, let me know where I should be suggesting these PRs. Shall I do it for 0.4.0, master or both?

Regarding image sizes, I just faced a need for larger dimensions, so I changed the profileImageUrl for FB and Twitter. Thought perhaps this should be the default. What do you think?

@ilanbiala
Copy link
Member

@igorauad 0.4.0 is preferred so they get merged into the new version. I'm okay with these changes, but even though it's so little I'd prefer the username and image changes to be in 2 separate PRs just because they are pretty different things.

Also, is there any way to test these OAuth flows and configs? I couldn't think of a good way, but we should really be testing these just like we test our own API because changes may happen without us knowing and the tests would let us know.

@igorauad igorauad changed the title Remove username from facebook strategy and adjust images for fb and twitter... Adjust profile image dimensions for Fb and Twitter Jan 30, 2015
@igorauad
Copy link
Contributor Author

You are right, @ilanbiala ! I will separate them. This one has only the image changes now.

Testing OAuth would be interesting, I don't know an easy way of testing either. I have tested for Fb here I realized it was not working due to username.

Maybe at least a standard .env file being loaded by grunt-env or a gulp correspondent would help.

@ilanbiala
Copy link
Member

LGTM. @lirantal @NeverOddOrEven looks good?

@@ -30,7 +30,7 @@ module.exports = function(config) {
displayName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
profileImageURL: (profile.photos && profile.photos.length) ? profile.photos[0].value : undefined,
profileImageURL: (profile.id) ? 'https:graph.facebook.com/' + profile.id + '/picture?type=large' : undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it actually https:graph or is that a typo and should read really https://graph...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be a typo, but I am actually using it this way and it is working. I will change it as soon as we decide whether //graph should be used.

@lirantal
Copy link
Member

@igorauad is the change there means that we won't be storing the profile image on the meanjs project but rather take it from facebook using the URL there? If so, then websites which are enabling http:// and not SSL might have browsers block SSL communication (and vice-versa) due to security issues

@simison
Copy link
Member

simison commented Jan 31, 2015

Please use //graph... instead of https://graph... and it'll work with both http and https.

@igorauad
Copy link
Contributor Author

@lirantal we were not storing the profile image, but rather storing another URL from https://scontent-b.xx.fbcdn.net for a 50x50 image (too small). I read somewhere that it is better to use the Graph API instead of relying on facebook CDN, so I changed it. Also because it is apparently easier to play with the image size through the Graph API.

@lirantal @simison , so, shall I change to //graph? This would work with ng-src also?

@lirantal
Copy link
Member

@igorauad I'm unable to test, but please do change it to //graph and test it to say if it works or not before committing.

@igorauad
Copy link
Contributor Author

igorauad commented Feb 1, 2015

@lirantal I've tested. The protocol-relative URL works.

@igorauad igorauad force-pushed the providerImages branch 2 times, most recently from c92d3fa to 0a1c33a Compare February 1, 2015 16:11
@@ -26,7 +26,7 @@ module.exports = function(config) {
var providerUserProfile = {
displayName: profile.displayName,
username: profile.username,
profileImageURL: (profile.photos && profile.photos.length) ? profile.photos[0].value : undefined,
profileImageURL: (profile.photos && profile.photos.length) ? profile.photos[0].value.replace('normal', 'bigger') : undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where a user won't have a photo that you have to check that it exists first? I would think even the bird would be the first profile picture, no? And is [0] the latest or the first?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think FB and Twitter would return a default image if the user hasn't uploaded one. I haven't tested this though.

https://developers.facebook.com/docs/graph-api/reference/v2.2/user/picture

Looks like is_silhouette can be used to detect the if the default picture been replaced or not.

On Feb 1, 2015, at 11:18 AM, Ilan Biala notifications@github.com wrote:

In modules/users/server/config/strategies/twitter.js:

@@ -26,7 +26,7 @@ module.exports = function(config) {
var providerUserProfile = {
displayName: profile.displayName,
username: profile.username,

  •           profileImageURL: (profile.photos && profile.photos.length) ? profile.photos[0].value : undefined,
    
  •           profileImageURL: (profile.photos && profile.photos.length) ? profile.photos[0].value.replace('normal', 'bigger') : undefined,
    
    Is there a case where a user won't have a photo that you have to check that it exists first? I would think even the bird would be the first profile picture, no? And is [0] the latest or the first?


Reply to this email directly or view it on GitHub.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but is that in the array? If it is, then we don't need to check the length and existence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is in the array, @ilanbiala . I've just tested here. Twitter returns

[ { value: 'https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png' } ]

For Fb, use the Graph API. For twitter, use the 'bigger' profile image. Larger profile images (like the one provided by Google) could provide more flexibility.
@ilanbiala
Copy link
Member

LGTM, @lirantal any suggestions?

@lirantal
Copy link
Member

lirantal commented Feb 6, 2015

@ilanbiala I'm ok with it.

ilanbiala added a commit that referenced this pull request Feb 6, 2015
Use larger profile images for Facebook and Twitter
@ilanbiala ilanbiala merged commit dd9a3af into meanjs:0.4.0 Feb 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants