Enrique Moreno Tent
Enrique Moreno Tent

Reputation: 25267

Flickr API - Include photo in website

Im trying to get the lastest photos uploaded by a user in my website, but im not sure how to get the URL to that resource. I can get the ID of a picture using "flickr.photosets.getPhotos", but I have no idea how to get the url for my tag. Can someone please help me?

Upvotes: 1

Views: 4300

Answers (4)

ajennings
ajennings

Reputation: 226

You might want to try just passing the 'extras' query parameter a value for the URL that you want to return. For example, if your request has ?extras=url_m, the photo object in the response will look like:

{
    "id": "8475556512",
    "secret": "beca454079",
    "server": "8102",
    "farm": 9,
    "title": "new",
    "isprimary": "0",
    "url_m": "https:\/\/farm9.staticflickr.com\/8102\/8475556512_beca454079.jpg",
    "height_m": "500",
    "width_m": "386"
}

Temboo has a nice interface for testing Flickr methods. You can try it out here: https://www.temboo.com/library/Library/Flickr/. They have SDKs in JAVA, Python, PHP, Ruby, Node.js, Android, and iOS.

(Full disclosure: I work at Temboo)

Upvotes: 4

sofl
sofl

Reputation: 1024

There is a pretty simple example to do this with jquery http://api.jquery.com/jQuery.getJSON/

Upvotes: 0

xueliang liu
xueliang liu

Reputation: 556

From a tag, a call could be made by

http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=YOU-API-KEY&tags=Your-tag&api_sig=Your-API-sig

and the output is something like

<photo id="213636561" owner="49719616@N00" secret="55187e8a7d" server="86" farm="1" title="Hawaii Kauai I - The myth is there" ispublic="1" isfriend="0" isfamily="0" \>

the URL of photo is formatted as

http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg

Upvotes: 0

David Gorsline
David Gorsline

Reputation: 5018

You can get the tags for a given user with flickr.tags.getListUser. You can search by tag with flickr.photos.search.

Update

Fill in the tag string ("horses" or "sunset" or whatever) to the tags argument to flickr.photos.search. The API Explorer page for this endpoint is very helpful: you can fill in example arguments, query the endpoint, and see your results interactively.

Update

Oh, you mean the HTML tag.

See these instructions on how to construct the URL of an image.

Update

The farm ID is available from the flickr.photos.getInfo API call. The example doesn't show it, but if you run it with the API Explorer, you'll see it.

Upvotes: 1

Related Questions