本文整理汇总了PHP中Zend_Gdata_Media_Extension_MediaKeywords类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Media_Extension_MediaKeywords类的具体用法?PHP Zend_Gdata_Media_Extension_MediaKeywords怎么用?PHP Zend_Gdata_Media_Extension_MediaKeywords使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Gdata_Media_Extension_MediaKeywords类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_new_photo_to_album
function add_new_photo_to_album($gp, $path, $new_album_name)
{
$user_name = "default";
$file_name = $path;
$photo_name = "Photo added by Facebook Album Challenge";
$photo_caption = "Photo added by Facebook Album Challenge";
$photo_tags = "Photo, Facebook-Album-Challenge";
$fd = $gp->newMediaFileSource($file_name);
$fd->setContentType("image/jpeg");
// Create a PhotoEntry
$photo_entry = $gp->newPhotoEntry();
$photo_entry->setMediaSource($fd);
$photo_entry->setTitle($gp->newTitle($photo_name));
$photo_entry->setSummary($gp->newSummary($photo_caption));
// add some tags
$photo_media = new Zend_Gdata_Media_Extension_MediaKeywords();
$photo_media->setText($photo_tags);
$photo_entry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
$photo_entry->mediaGroup->keywords = $photo_media;
// We use the AlbumQuery class to generate the URL for the album
$album_query = $gp->newAlbumQuery();
$album_query->setUser($user_name);
$album_query->setAlbumName($new_album_name);
$gp->insertPhotoEntry($photo_entry, $album_query->getQueryUrl());
}
示例2: setVideoTags
/**
* Sets the keyword tags for a video.
*
* @param mixed $tags Either a comma-separated string or an array
* of tags for the video
* @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface
*/
public function setVideoTags($tags)
{
$this->ensureMediaGroupIsNotNull();
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
if (is_array($tags)) {
$tags = implode(', ', $tags);
}
$keywords->setText($tags);
$this->getMediaGroup()->setKeywords($keywords);
return $this;
}
示例3: takeChildFromDOM
/**
* Creates individual Entry objects of the appropriate type and
* stores them in the $_entry array based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('media') . ':' . 'content':
$content = new Zend_Gdata_Media_Extension_MediaContent();
$content->transferFromDOM($child);
$this->_content[] = $content;
break;
case $this->lookupNamespace('media') . ':' . 'category':
$category = new Zend_Gdata_Media_Extension_MediaCategory();
$category->transferFromDOM($child);
$this->_category[] = $category;
break;
case $this->lookupNamespace('media') . ':' . 'copyright':
$copyright = new Zend_Gdata_Media_Extension_MediaCopyright();
$copyright->transferFromDOM($child);
$this->_copyright = $copyright;
break;
case $this->lookupNamespace('media') . ':' . 'credit':
$credit = new Zend_Gdata_Media_Extension_MediaCredit();
$credit->transferFromDOM($child);
$this->_credit[] = $credit;
break;
case $this->lookupNamespace('media') . ':' . 'description':
$description = new Zend_Gdata_Media_Extension_MediaDescription();
$description->transferFromDOM($child);
$this->_description = $description;
break;
case $this->lookupNamespace('media') . ':' . 'hash':
$hash = new Zend_Gdata_Media_Extension_MediaHash();
$hash->transferFromDOM($child);
$this->_hash[] = $hash;
break;
case $this->lookupNamespace('media') . ':' . 'keywords':
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
$keywords->transferFromDOM($child);
$this->_keywords = $keywords;
break;
case $this->lookupNamespace('media') . ':' . 'player':
$player = new Zend_Gdata_Media_Extension_MediaPlayer();
$player->transferFromDOM($child);
$this->_player[] = $player;
break;
case $this->lookupNamespace('media') . ':' . 'rating':
$rating = new Zend_Gdata_Media_Extension_MediaRating();
$rating->transferFromDOM($child);
$this->_rating[] = $rating;
break;
case $this->lookupNamespace('media') . ':' . 'restriction':
$restriction = new Zend_Gdata_Media_Extension_MediaRestriction();
$restriction->transferFromDOM($child);
$this->_restriction[] = $restriction;
break;
case $this->lookupNamespace('media') . ':' . 'text':
$text = new Zend_Gdata_Media_Extension_MediaText();
$text->transferFromDOM($child);
$this->_mediaText[] = $text;
break;
case $this->lookupNamespace('media') . ':' . 'thumbnail':
$thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
$thumbnail->transferFromDOM($child);
$this->_thumbnail[] = $thumbnail;
break;
case $this->lookupNamespace('media') . ':' . 'title':
$title = new Zend_Gdata_Media_Extension_MediaTitle();
$title->transferFromDOM($child);
$this->_title = $title;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
示例4: updatePhotoMetaData
public function updatePhotoMetaData()
{
$client = $this->photos;
$album = $this->createAlbum();
$insertedEntry = $this->createPhoto($album);
$insertedEntry->title->text = "New Photo";
$insertedEntry->summary->text = "Photo caption";
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
$keywords->setText("foo, bar, baz");
$insertedEntry->mediaGroup->keywords = $keywords;
$updatedEntry = $insertedEntry->save();
return array($updatedEntry, $album);
}
示例5: uploadpicture
function uploadpicture()
{
//uploading photo to server
$_data['new_album_name'] = $newAlbumName = $this->input->post('new_album_name');
$_data['album_id'] = $albumId = $this->input->post('album_id');
//var_dump($_SESSION);
if (!($albumId || $newAlbumName)) {
//echo "test";
$_data['msg'] = $msg = 'You should select album or enter new album name';
$_data['albums'] = $this->_getAlbums();
} elseif (!empty($_FILES['image'])) {
$uploaddir = BASEPATH . '../pictures';
$fname = $_FILES['image']['name'];
$fsize = $_FILES['image']['size'];
$ftmpname = $_FILES['image']['tmp_name'];
$ext = '';
if (preg_match("/.+(\\..+)\$/i", $fname, $matches)) {
$ext = strtolower($matches[1]);
}
//file extension
$filename = $this->_genFileName($ext, $uploaddir);
$uploadfile = $uploaddir . '/' . $filename;
//debug: //echo $uploadfile;
//$fsize < 3000000 //allow to upload only pics that less then file_upload_size bytes
if (in_array($ext, array(".gif", ".png", ".jpg"))) {
if (move_uploaded_file($ftmpname, $uploadfile)) {
//uploaded
$uploaded = TRUE;
} else {
//Error while uploading file
}
} else {
//Picture shouldn't exceed file_upload_size bytes
$_data['msg'] = $msg = 'Uploaded file should be a picture';
}
} else {
$_data['msg'] = $msg = 'You should select picture to upload';
}
if (empty($uploaded)) {
if (empty($msg)) {
$_data['msg'] = $msg = 'Cannot upload file';
}
$_data['albums'] = $this->_getAlbums();
$this->load->view('member_post_picture', $_data);
//exit;
} else {
$photoName = "Test";
$photoCaption = "Uploaded to Picasa Web Albums via PHP.";
$photoTags = "";
$fd = $this->gp->newMediaFileSource($uploadfile);
$fd->setContentType("image/jpeg");
// Create a PhotoEntry
$photoEntry = $this->gp->newPhotoEntry();
$photoEntry->setMediaSource($fd);
$photoEntry->setTitle($this->gp->newTitle($photoName));
$photoEntry->setSummary($this->gp->newSummary($photoCaption));
// add some tags
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
$keywords->setText($photoTags);
$photoEntry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
$photoEntry->mediaGroup->keywords = $keywords;
// We use the AlbumQuery class to generate the URL for the album
$albumQuery = $this->gp->newAlbumQuery();
$albumQuery->setUser($this->username);
if ($albumId) {
$albumQuery->setAlbumId($albumId);
} else {
$entry = new Zend_Gdata_Photos_AlbumEntry();
$entry->setTitle($this->gp->newTitle($newAlbumName));
$entry->setSummary($this->gp->newSummary(""));
$createdEntry = $this->gp->insertAlbumEntry($entry);
//$albumQuery->setAlbumName($newAlbumName);
$albumQuery->setAlbumId((string) $createdEntry->gphotoId);
//Zend_Debug::dump((string)$createdEntry->gphotoId);
}
// We insert the photo, and the server returns the entry representing
// that photo after it is uploaded
$insertedEntry = $this->gp->insertPhotoEntry($photoEntry, $albumQuery->getQueryUrl());
if ($insertedEntry->getMediaGroup()->getContent() != null) {
$mediaContentArray = $insertedEntry->getMediaGroup()->getContent();
$contentUrl = $mediaContentArray[0]->getUrl();
print "<pre>";
var_dump($contentUrl);
print "</pre>";
if (!empty($this->fbUserId) && !empty($this->userSettings) && $this->userSettings[0]['facebook_pics_y_n'] == 1) {
// uploading picture to Facebook
//$Albums = $this->facebook->api_client->photos_getAlbums($this->fbUserId, null);
//if(!empty($Albums)) $AlbumId = $Albums[0]['aid']; else $AlbumId = null;
//print"<pre>";var_dump($AlbumId);print"</pre>";
try {
$this->facebook->api_client->photos_upload($uploadfile, null, "Uploading image with " . $this->conf['site_name'], $this->fbUserId);
//$this->facebook->api_client->photos_upload($uploadfile, $AlbumId, "Uploading image with pep6", $this->fbUserId);
} catch (Exception $ex) {
echo $ex->getMessage();
//echo "Cannot upload picture to facebook";
}
}
$lastMessage = $this->Post_model->getWhere(null, $limit = 1, $offset = 0, $order = 'id DESC');
if (!empty($lastMessage) && $lastMessage[0]['user_id'] == $this->getUserId() && $lastMessage[0]['site_id'] == $this->subdomainId && $lastMessage[0]['post_type'] == 'picture') {
$this->Post_pictures_model->insert($lastMessage[0]['id'], $contentUrl);
//.........这里部分代码省略.........