Guest User

FlickrSets

a guest
Jan 7th, 2013
112
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function flickr_sets_html( $apikey, $user )
  2. {
  3.     $f = new phpFlickr( "$apikey" );
  4.     $f->enableCache( "fs", "phpflickr/cache" );
  5.     $photos_url = $f->urls_getUserPhotos( "$user" );
  6.     $sets = $f->photosets_getList( "$user", NULL, NULL, 36 );
  7.     $fphotos = array( );
  8.     $html = "";
  9.     foreach( $sets['photoset'] as $set )
  10.     {
  11.         $set_title = $set['title'];
  12.         $set_id = $set['id'];
  13.         $setphotos = $f->photosets_getPhotos( $set_id );
  14.         $html .="<div class=\"fset\">\n";
  15.         $html .= "<h1>$set_title</h1>\n";
  16.  
  17.         foreach( $setphotos['photoset']['photo'] as $photo )
  18.         {
  19.             $photo_id = $photo['id'];
  20.             $photo_title = $photo['title'];
  21.  
  22.             $aux['f_set_title'] = "$set_title";
  23.             $aux['f_href'] = "$photos_url$photo_id";
  24.             $aux['f_href_m'] = $f->buildPhotoURL( $photo, "Medium" );
  25.             $aux['f_href_l'] = $f->buildPhotoURL( $photo, "Large" );
  26.             $aux['f_href_s'] = $f->buildPhotoURL( $photo, "Square" );
  27.             $aux['f_title'] = "$photo_title";
  28.             $aux['f_src_s'] = $f->buildPhotoURL( $photo, "Square" );
  29.             $aux['f_src_m'] = $f->buildPhotoURL( $photo, "Medium" );
  30.             $aux['f_src_l'] = $f->buildPhotoURL( $photo, "Large" );
  31.  
  32.             $html .= "<li>\n";
  33.             $html .= " <a href=\"" . $aux['f_href_l'] . "\" title=\"" . $aux['f_title'] . "\" rel=\"$set_id\"> <img src=\"" . $aux['f_src_s'] . "\"  /> </a>\n";
  34.             $html .= "</li>\n";
  35.  
  36.             unset( $aux );
  37.         }
  38.  
  39.         $html .="</div>\n\n";
  40.     }
  41.     return $html;
  42. }
RAW Paste Data