Вы находитесь на странице: 1из 3

Flickr services provided by zend framework :

Zend_Service_Flickr
$flickr = new Zend_Service_Flickr('MY_API_KEY');

$results = $flickr->userSearch($userEmail/$username);

Data returned by this function :

1) Total number of results in this result set


2) All the public images of the user(array), image details like image uri, name
and sizes etc.

It will provide all the images(public) or the user. But it doesn’t provide the
photoset(album) details.

So I have used the fickr liabrary of php (phpflickr) to get all image details of a user
like album, album cover, photo url.

The functions used are :

1. people_findByUsername($username) : returns user_id of the provided user


$flickrResponse = $f->people_findByUsername($username);
$flickrUserid = $flickrResponse["id"];

2. urls_getUserPhotos($user_id) : Get a list of public photos for the given user.


$userPhotos = $f->people_getPublicPhotos($flickrUserid);

Data returned by this is:


<photo id="3742015691" owner="40020614@N07" secret="d38a88a8c3"
server="2621" farm="3" title="image005" ispublic="1" isfriend="0"
isfamily="0"/>

Photo Source URLs


You can construct the source URL to a photo once you know its ID, server ID,
farm ID and secret, as returned by many API methods.
The URL takes the following format:
http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg
or
http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg
or
http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|
png)
To make uri of the image we need imageid, farmid, secret , server id.
http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg
http://farm3.static.flickr.com/2486/3742015693_356b061293_m.jpg

farm-id: 3
server-id: 2 486
photo-id: 3742015693
secret: 356b061293
size: m
3. photosets_getList($flickrUserid): Returns the photosets belonging to the
specified user.

$userPhotoSets = $f->photosets_getList($flickrUserid);

Data returned is:

<photoset id="72157621759541436" primary="3742015693"


secret="356b061293" server="2486" farm="3" photos="4" videos="0">

<title>raghu1</title>

<description/>

</photoset>

4. photosets_getPhotos ($photoset_id): Get the list of photos in a set.

$photos = $f->photosets_getPhotos($value["id"]);

Data returned is:

<photoset id="72157621759541436" primary="3742015693"


owner="40020614@N07" ownername="raghurajshekhawat" page="1"
per_page="500" perpage="500" pages="1" total="4">
<photo id="3742015693" secret="356b061293" server="2486" farm="3"
title="image00109" isprimary="1"/>
<photo id="3742015691" secret="d38a88a8c3" server="2621" farm="3"
title="image005" isprimary="0"/>
<photo id="3726500980" secret="f129672012" server="3502" farm="4"
title="4858_1147788104589_1524150112_366651_5260866_n"
isprimary="0"/>
<photo id="3725694425" secret="087e1476cd" server="2518" farm="3"
title="4504_1135849246125_1524150112_330541_19436_n"
isprimary="0"/>
</photoset>

Вам также может понравиться