Foursquare API for venue user image error
Asked Answered
C

5

23

The Foursquare API has divided its photo tag for user as prefix and suffix. But if I merge them to form a full image URL and paste this in my browser, gives me errors that says the image can't be displayed because it contains errors. Is it because server is temporarily unavailable or anything else?

I am using the API for Venue Detail.

I got the data like this:

user: {

id: "26534686"
firstName: "Bobbi"
lastName: "E."
photo: {
    prefix: "https://irs3.4sqi.net/img/user/"
    suffix: "/K4VCI4MXHWFUGXOF.jpg"
}
}
visibility: "public" 

But when I call this url https://irs3.4sqi.net/img/user/K4VCI4MXHWFUGXOF.jpg gives me error.

Any clue?

Chef answered 11/6, 2012 at 9:4 Comment(2)
hello,Can u please guide me in photo uploading o foursquare ???Gompers
You can make an http request to api.foursquare.com/v2/photos/add . For details see here developer.foursquare.com/docs/photos/add ... ThanksChef
C
43

I don't know its right or not to show the way to Foursquare. But what I have investigated that Foursquare creates thumbnails of sizes 30 x 30 and 110 x 110 etc.

I formed the image path like this for small image

user->photo->prefix.'30x30'.user->photo->suffix;

for larger size

user->photo->prefix.'110x110'.user->photo->suffix;

That is I have concatenated them with (30x30) and (110x110).

Thus the above image becomes https://irs3.4sqi.net/img/user/30x30/K4VCI4MXHWFUGXOF.jpg and https://irs3.4sqi.net/img/user/110x110/K4VCI4MXHWFUGXOF.jpg which are valid till now.

Hope this will work until they change this.

Chef answered 12/6, 2012 at 9:30 Comment(2)
Actually, it looks like you can put in arbitrary dimensions and Foursquare will return a scaled image (up to size of the original uploaded image). For instance, try: irs3.4sqi.net/img/user/100x400/K4VCI4MXHWFUGXOF.jpgEligibility
yeah, seems so now..but my above dimensions are taken from Foursquare page view source. BTW you can get the original image replacing the dimension by 'original' .Chef
O
13

As per the Foursquare documentation that is now updated:

To assemble a resolvable photo URL, take prefix + size + suffix, e.g. https://irs0.4sqi.net/img/general/300x500/2341723_vt1Kr-SfmRmdge-M7b4KNgX2_PHElyVbYL65pMnxEQw.jpg.

size can be one of the following, where XX or YY is one of 36, 100, 300, or 500.

  • XXxYY
  • original: the original photo's size
  • capXX: cap the photo with a width or height of XX (whichever is larger). Scales the other, - smaller dimension proportionally
  • widthXX: forces the width to be XX and scales the height proportionally
  • heightYY: forces the height to be YY and scales the width proportionally
Omophagia answered 12/12, 2013 at 20:37 Comment(0)
U
9

This is a change foursquare did on June 9th, see AK announcement on the google group here: https://groups.google.com/forum/#!topic/foursquare-api/MpNpdO5zARU

To fix it, in your request change the 'v' to a value below 20120609, 20120608 will work and return a url (json string) with the thumbnail of the user picture.

There is no documentation on how to use the prefix/suffix thing yet.. they will probably post about it when there will be.

Found out you can also access it via [prefix]/original/[suffix], and then use the newer version (>20120609)

Untitled answered 11/6, 2012 at 13:27 Comment(2)
Would be nice if you shared how - you can always answer on your own question if you figure it out..Untitled
[prefix] dimensions [suffix] is the correct format. As the prefix and suffix have / appended already, all you need to do is add a string with the dimensions of the image, such as 100x100Mccall
H
3

this is the format I use when using categories picture url

prefix -> https://ss3.4sqi.net/img/categories_v2/nightlife/karaoke_

karaoke is the image name always followed by an underscore then the image size.

suffix -> .png

then add the valid sizes. there are many sizes supported by I use 64

so https://ss3.4sqi.net/img/categories_v2/nightlife/karaoke_64.png

Hex answered 8/3, 2016 at 16:7 Comment(0)
U
0

The correct format will be {image_prefix}/300x500/{image_suffix} for image having length as 300 while breadth as 500

https://fastly.4sqi.net/img/general/300x500/7543787_aJ1JJo9mUpnUTBvKVZeOkX7c94G8G9K66thf4Qdlo5c.jpg

Unstoppable answered 18/7, 2023 at 18:49 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Corina

© 2022 - 2024 — McMap. All rights reserved.