本文整理汇总了PHP中Zend_Gdata_Media_Extension_MediaKeywords::setText方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Media_Extension_MediaKeywords::setText方法的具体用法?PHP Zend_Gdata_Media_Extension_MediaKeywords::setText怎么用?PHP Zend_Gdata_Media_Extension_MediaKeywords::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Media_Extension_MediaKeywords
的用法示例。
在下文中一共展示了Zend_Gdata_Media_Extension_MediaKeywords::setText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: 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);
//.........这里部分代码省略.........