Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Construct Profile Picture URL

Tags:

foursquare

Most social apis have a way to construct a url to the user's profile picture using their user_id or username. Any chance foursquare has something similar or plans to?

http://graph.facebook.com/702855/picture

http://api.twitter.com/1/users/profile_image/akdotcom.png

like image 397
gerbz Avatar asked Dec 02 '11 18:12

gerbz


People also ask

How do you put a profile picture in HTML?

Image preview files[0]) { var imageFile = uploader. files[0]; var reader = new FileReader(); reader. onload = function (e) { //set the image data as source $('#profileImage'). attr('src', e.

How do you get the URL for your Instagram profile picture?

You get source URL to the picture in "profile_pic_url" : & "profile_pic_url_hd" in the message Body which is the link to the profile photo, hope it helps. This works until Instagram rate limits your ip.


2 Answers

I had the same problem.

Since the last update (changes from June 9th) every user's pic can be constructed via an api call: https://developer.foursquare.com/docs/explore#req=users/self

which returns something like this:

photo: {
    prefix: "https://irs3.4sqi.net/img/user/"
    suffix: "/HBVX4T2WQOGG20FE.png"
}

Take the two parts and put e.g. 'original' between them:

[prefix]/original/[suffix]

which gives you the url to the profile pic: https://irs3.4sqi.net/img/user/original/HBVX4T2WQOGG20FE.png

like image 105
kurt Avatar answered Sep 20 '22 15:09

kurt


foursquare provides the URL prefix and suffix, example:

photo: {
  prefix: "https://irs3.4sqi.net/img/user/"
  suffix "/21325770-GWARVMMU2R5QLN04.jpg"
}

you can mount it as follows:

[prefix]/original/[suffix] -> for original image
[prefix]/200/[suffix] -> for squared 200x200 image
[prefix]/200x100/[suffix] -> for 200x100 image

exemple

https://irs3.4sqi.net/img/user/200/21325770-GWARVMMU2R5QLN04.jpg
like image 25
Marcelito Costa Avatar answered Sep 22 '22 15:09

Marcelito Costa