/** * 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."; } }
public function createTag($photo) { $client = $this->photos; $tag = new Zend_Gdata_Photos_TagEntry(); $tag->setTitle($client->newTitle("test tag")); $tag->setContent($client->newContent("test tag")); $tag->setCategory(array($client->newCategory('http://schemas.google.com/photos/2007#tag', 'http://schemas.google.com/g/2005#kind'))); $newTag = $client->insertTagEntry($tag, $photo); $this->assertEquals($tag->getTitle(), $newTag->getTitle()); $this->assertEquals($newTag->getTitle(), $client->getTagEntry($newTag->getLink('self')->href)->getTitle()); return $newTag; }