I want to show the leaderboard with the users facebook profile picture on the list, how would you recommend to do it? Is there any way to query through the API for the profile picture or should I query the externalIds collection directly?
The key bit of information here is the uploadId, for a user's profile picture you could store some data on a user's player scriptData which contains this uploadId, something like:
To get the FB profile picture you need the facebook id of the player, I'm assuming you already have this, so an approach we have seen taken is to add this value as an additional unsorted attribute on the score event. You can then add it to your leaderboard as an unsorted value.
When you post your score, you also post the facebook id, this mean when you get the leaderboard data the results already have the id's you need in and you can construct your image using the http://graph.facebook.com/<facebookId>/picture?type=square
Hope thats useful!
Gabriel
1 person likes this
J
Jorge Aldao
said
over 8 years ago
Great solution! I think I'd never take that approach if you didn't tell me, thank you!
A
Ayyappa R
said
about 8 years ago
Hi what to do if we need to upload pictures and retrieve them back if other than facebook?
The key bit of information here is the uploadId, for a user's profile picture you could store some data on a user's player scriptData which contains this uploadId, something like:
If I'm understanding this correctly, populating a leaderboard of 50 players will now take 51 API calls. Since it's 1 + numEntries API calls. 1 for the retrieval of the leaderboard data that contains all the player details, then 1 call to request the picture URL for each player.
Is there no permalink for uploadables? This seems like a lot of overhead for something is normally free (server processing wise)
3 people like this
H
Henrik Larsson
said
over 4 years ago
Seconding Strider´s comment about permalinks.
My experience so far with the recommended procedure is that it's purpose-defeatingly slow and cumbersome.
Please create a better system for storing and retrieving images!
1 person likes this
N
Nick Gazzola
said
almost 4 years ago
Yes I too agree with this. I need to load the profile pic of the players in challenges and friends list, so downloading them everytime in all different screens, is not so best practice. Can we get the permanent URL from GetUploadedRequest api, instead of time sensitive URL.
N
Nick Gazzola
said
almost 4 years ago
Any updates on this ? Facing similar problem here too
Jorge Aldao
Hello again to everyone,
I want to show the leaderboard with the users facebook profile picture on the list, how would you recommend to do it? Is there any way to query through the API for the profile picture or should I query the externalIds collection directly?
Thank you very much,
Jorge Aldao
Hi Ayyappa,
First thing you'd do is get an upload URL using GetUploadUrlRequest
which should return something similar to this GetUploadUrlResponse:
You then use that URL to upload your file using POST.
One your file is uploaded you will receive an UploadCompleteMessage looking something like:
The key bit of information here is the uploadId, for a user's profile picture you could store some data on a user's player scriptData which contains this uploadId, something like:
whenever the players data is returned you will receive their information with the uploadId stored in scriptData like:
Then every time the log on you can use that uploadId in combination with a GetUploadedRequest like so:
and it will return the URL to acquire the file in a GetUploadedResponse:
Of course this method can be used for the profile picture or any other files.
If you are using Unity check out this topic where we take a screenshot of our game and upload it to GameSparks: https://support.gamesparks.net/discussions/topics/1000050374
Shane
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
Hi Jorge
To get the FB profile picture you need the facebook id of the player, I'm assuming you already have this, so an approach we have seen taken is to add this value as an additional unsorted attribute on the score event. You can then add it to your leaderboard as an unsorted value.
When you post your score, you also post the facebook id, this mean when you get the leaderboard data the results already have the id's you need in and you can construct your image using the http://graph.facebook.com/<facebookId>/picture?type=square
Hope thats useful!
Gabriel
1 person likes this
Jorge Aldao
Great solution! I think I'd never take that approach if you didn't tell me, thank you!
Ayyappa R
Hi what to do if we need to upload pictures and retrieve them back if other than facebook?
Customer Support
Hi Ayyappa,
First thing you'd do is get an upload URL using GetUploadUrlRequest
which should return something similar to this GetUploadUrlResponse:
You then use that URL to upload your file using POST.
One your file is uploaded you will receive an UploadCompleteMessage looking something like:
The key bit of information here is the uploadId, for a user's profile picture you could store some data on a user's player scriptData which contains this uploadId, something like:
whenever the players data is returned you will receive their information with the uploadId stored in scriptData like:
Then every time the log on you can use that uploadId in combination with a GetUploadedRequest like so:
and it will return the URL to acquire the file in a GetUploadedResponse:
Of course this method can be used for the profile picture or any other files.
If you are using Unity check out this topic where we take a screenshot of our game and upload it to GameSparks: https://support.gamesparks.net/discussions/topics/1000050374
Shane
Strider Agostinelli
If I'm understanding this correctly, populating a leaderboard of 50 players will now take 51 API calls. Since it's 1 + numEntries API calls. 1 for the retrieval of the leaderboard data that contains all the player details, then 1 call to request the picture URL for each player.
Is there no permalink for uploadables? This seems like a lot of overhead for something is normally free (server processing wise)
3 people like this
Henrik Larsson
Seconding Strider´s comment about permalinks.
My experience so far with the recommended procedure is that it's purpose-defeatingly slow and cumbersome.
Please create a better system for storing and retrieving images!
1 person likes this
Nick Gazzola
Yes I too agree with this. I need to load the profile pic of the players in challenges and friends list, so downloading them everytime in all different screens, is not so best practice. Can we get the permanent URL from GetUploadedRequest api, instead of time sensitive URL.
Nick Gazzola
Any updates on this ? Facing similar problem here too
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics