Пример #1
0
/**
 * Adds a new tag to the specified photo
 *
 * @param  Zend_Http_Client $client The authenticated client
 * @param  string           $user   The user's account name
 * @param  integer          $album  The album's id
 * @param  integer          $photo  The photo's id
 * @param  string           $tag    The tag to add to the photo
 * @return void
 */
function addTag($client, $user, $album, $photo, $tag)
{
    $photos = new Zend_Gdata_Photos($client);
    $entry = new Zend_Gdata_Photos_TagEntry();
    $entry->setTitle($photos->newTitle($tag));
    $photoQuery = new Zend_Gdata_Photos_PhotoQuery();
    $photoQuery->setUser($user);
    $photoQuery->setAlbumId($album);
    $photoQuery->setPhotoId($photo);
    $photoQuery->setType('entry');
    $photoEntry = $photos->getPhotoEntry($photoQuery);
    $result = $photos->insertTagEntry($entry, $photoEntry);
    if ($result) {
        outputPhotoFeed($client, $user, $album, $photo);
    } else {
        echo "There was an issue with the tag creation.";
    }
}