[Sakai Jira] Commented: (SAKIII-2530) Investigate preview URL for Flickr images
Bert Pareyn (JIRA)
sakai-ui-dev-tracking at collab.sakaiproject.org
Fri Mar 11 04:21:43 PST 2011
[ https://jira.sakaiproject.org/browse/SAKIII-2530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=122625#comment-122625 ]
Bert Pareyn commented on SAKIII-2530:
Users will be providing links to a photo on Flickr. In order to display this picture we need to know 4 things: farm-id, server-id, photo-id and secret (More on http://www.flickr.com/services/api/misc.urls.html).
Since the user will (should) not be bothered looking this up in the source code of the Flickr page we need to access the API to get this information. In order to access the API we need an API token. To get an API token we need to be registered. A typical user-pasted URL will look something along the lines of http://www.flickr.com/photos/ccgd/107274692/.
The API provides 'flickr.photos.getInfo' which requires a photo_id. We can strip this from the url (in this case 107274692) and send it to the API function. By default this returns XML but can be turned into JSON by adding '&format=json'. The returned JSON will not be valid as it's wrapped in 'jsonFlickrApi()' which can be removed to get valid JSON.
The returned data provides everything needed to build the image URL. We need to build a URL looking like this:
In this case this is the data that's returned from the API (not all of it, this is what we need):
"id": "107274692", -> id
"secret": "c6c32bba58", -> secret
"server": "44", -> server-id
"farm": 1, -> farm-id
which lets us generate the following URL:
http://farm1.static.flickr.com/44/107274692_c6c32bba58.jpg -> Ready to go!
which, in this case, makes the link:
And voila, we have Flickr preview support.
> Investigate preview URL for Flickr images
> Key: SAKIII-2530
> URL: https://jira.sakaiproject.org/browse/SAKIII-2530
> Project: Sakai 3 UI Dev
> Issue Type: Sub-task
> Components: Content & Media
> Affects Versions: Sprint 106
> Reporter: Nicolaas Matthijs
> Assignee: Bert Pareyn
> Fix For: Sprint 106
> Investigate how we can preview/show a Flickr image from a Flickr URL.
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the sakai-ui-dev-tracking