Hi,

You should be able to do this by retrieving the "tag" kind from a user
feed:

http://picasaweb.google.com/data/feed/api/user/default/?kind=tag

(Either authenticate that request or replace 'default' with your
username.)

You can also accomplish this by using setKind() on a UserQuery object.

Cheers,
-Jeff


On Dec 2, 1:35 am, ejepsen <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to create a "tag-cloud" with the top 40 most used tags
> for my 1700 photos. So far the only way I have found to do this is to
> traverse all tags in all photos in all albums.... using foreach loops
> - this adds up to quite a lengthy affair... is there a better way to
> do this?
> If this is the only way then I'll probably need to cache the result -
> is there any good methods out there other than just throwing it into
> mysql?
>
> I've posted function below.
>
> function getAllTags($client, $user)
> {
>     $photos = new Zend_Gdata_Photos($client);
>
>     $query['user'] = new Zend_Gdata_Photos_UserQuery();
>     $query['user']->setUser($user);
>
>     $userFeed = $photos->getUserFeed(null, $query['user']);
>
>     echo "<h2>User Feed for: " . $userFeed->getTitle() . "</h2>";
>
>     foreach ($userFeed as $entry['user']) {
>         if ($entry['user'] instanceof Zend_Gdata_Photos_AlbumEntry) {
>
>             $albumId = $entry['user']->getGphotoId();
>
>             $query['album'] = new Zend_Gdata_Photos_AlbumQuery();
>             $query['album']->setUser($user);
>             $query['album']->setAlbumId($albumId);
>
>             $albumFeed = $photos->getAlbumFeed($query['album']);
>
>             foreach ($albumFeed as $entry['album']) {
>                 if ($entry['album'] instanceof
> Zend_Gdata_Photos_PhotoEntry) {
>                     $photoId = $entry['album']->getGphotoId();
>
>                     $query['photo'] = new Zend_Gdata_Photos_PhotoQuery
> ();
>                     $query['photo']->setUser($user);
>                     $query['photo']->setAlbumId($albumId);
>                     $query['photo']->setPhotoId($photoId);
>                     $query['photo']->setKind('tag');
>
>                     $photoFeed = $photos->getPhotoFeed($query
> ['photo']);
>
>                     foreach ($photoFeed as $entry['photo']) {
>                         if ($entry['photo'] instanceof
> Zend_Gdata_Photos_TagEntry) {
>
>                             $tag = (string) $entry['photo']->getTitle
> ().", <br>";
>                             $tag_arr[$tag]++;
>                         }
>                     }
>                 }
>             }
>         }
>     }
>     echo "<pre>".print_r($tag_arr,1)."</pre>";
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to