使用 Zend GData Picasa API 更新 Picasa 视频缩略图
我想使用 API 更新 picasa 网络相册中视频的缩略图。 我有 照片 PHP 示例代码 用于运行照片数据 API。
文档称我可以“提供您自己的视频缩略图”通过更新照片。
我尝试过以下功能,但没有任何反应。请帮忙!
/**
* Updates photo (for changing video thumbs
*
* @param Zend_Http_Client $client The authenticated client
* @param string $user The user's account name
* @param integer $albumId The album's id
* @param integer $photoId The photo's id
* @param array $photo The uploaded photo
* @return void
*/
function updatePhoto($client, $user, $albumId, $photoId, $photo)
{
$photos = new Zend_Gdata_Photos($client);
$photoQuery = new Zend_Gdata_Photos_PhotoQuery;
$photoQuery->setUser($user);
$photoQuery->setAlbumId($albumId);
$photoQuery->setPhotoId($photoId);
$photoQuery->setType('entry');
$entry = $photos->getPhotoEntry($photoQuery);
$fd = $photos->newMediaFileSource($photo["tmp_name"]);
$fd->setContentType($photo["type"]);
$entry->setMediaSource($fd);
$entry->save();
outputPhotoFeed($client, $user, $albumId, $photoId);
}
I want to update the thumbnail of my video in picasa web albums using the API.
I've got the Photos PHP sample code for the Photos data API running.
The documentation says that I can "Provide your own video thumbnail" by updating the photo.
I've tried the following function but nothing happens. Please help!
/**
* Updates photo (for changing video thumbs
*
* @param Zend_Http_Client $client The authenticated client
* @param string $user The user's account name
* @param integer $albumId The album's id
* @param integer $photoId The photo's id
* @param array $photo The uploaded photo
* @return void
*/
function updatePhoto($client, $user, $albumId, $photoId, $photo)
{
$photos = new Zend_Gdata_Photos($client);
$photoQuery = new Zend_Gdata_Photos_PhotoQuery;
$photoQuery->setUser($user);
$photoQuery->setAlbumId($albumId);
$photoQuery->setPhotoId($photoId);
$photoQuery->setType('entry');
$entry = $photos->getPhotoEntry($photoQuery);
$fd = $photos->newMediaFileSource($photo["tmp_name"]);
$fd->setContentType($photo["type"]);
$entry->setMediaSource($fd);
$entry->save();
outputPhotoFeed($client, $user, $albumId, $photoId);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我几乎是对的,更新后的代码可以工作...
请参阅“更新 Picasa 网络视频的缩略图'以获取完整代码和工作示例。
i was nearly right, updated code that works...
See 'Updating Thumbnails of Picasa Web Videos' for full code and working example.