Get larger facebook image through firebase login

前端 未结 3 2379
生来不讨喜
生来不讨喜 2021-01-01 07:47

I am using firebase to login a user through facebook. This all works fine and I can get the users FB profile image, although it is to small. Can somebody tell me how to get

相关标签:
3条回答
  • 2021-01-01 08:31

    According to the Facebook documentation on Profile Picture, you should be able to specify the size by appending width and height to the url:

    let photoUrl = profile.photoURL?.absoluteString + "?width=\(width)&height=\(height)"
    

    or by specifying the type:

    let photoUrl = profile.photoURL?.absoluteString + "?type=large"
    
    0 讨论(0)
  • 2021-01-01 08:32

    Once you get the photo Url, just add "?width=400&height=400" to the photo url. Here, height=width=400, you can choose your own height and width. It surely works!

    0 讨论(0)
  • 2021-01-01 08:40

    Once the FB user authenticates, make a FBSDKGraphRequest using FBSDKGraphRequestConnection to get the users FBid, using which you can get the users profile picture by pluggin the id here:

    https://graph.facebook.com//picture?type=large&return_ssl_resources=1

    instead of type=large you can use ?width=<width>&height=<height> too

    too

    0 讨论(0)
提交回复
热议问题