Controller:
// fetch the sets for the user, including set thumbnail, title, and description
public function photostack() {
$params = array(
'method' => 'flickr.photosets.getList',
);
$sets = $this->Flickr->flickrRequest($params);
$this->set('sets', $sets);
}
// AJAX get the photos when a set is clicked
public function psfiles() {
$this->autoRender = false;
$params = array(
'method' => 'flickr.photosets.getPhotos',
'photoset_id' => $_GET['album_name'],
'per_page' => 3
);
$photos = $this->Flickr->flickrRequest($params);
foreach ($photos['photoset']['photo'] as $flk) {
$base = 'http://farm'.$flk['farm'].'.static.flickr.com/'.$flk['server'];
$base .= '/'.$flk['id'].'_'.$flk['secret'];
$files[] = $base.'.jpg';
}
$encoded = json_encode($files);
echo $encoded;
unset($encoded);
}
Helper:
// used in a foreach() loop, see the demo source...
echo $this->Flickr->getPhoto($set, '_s', 'img');