2010-12-01 19 views
0

APIを使用して、Picasaウェブアルバムで自分の動画のサムネイルを更新したいとします。 写真データAPIを実行するためのPhotos PHP sample codeがあります。Zend GDataを使用したPicasaビデオサムネイルの更新Picasa API

ドキュメントには、写真を更新して「Provide your own video thumbnail」とすることができます。

次の機能を試しましたが、何も起こりません。助けてください!

/** 
* 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);   
} 

答えて

1

なるほど 'Updating Thumbnails of Picasa Web Videosは' 完全なコードや作業例えば

/** 
    * 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); 
      $uri = $entry->getLink("edit-media")->href;    

      $fd = $photos->newMediaFileSource($photo["tmp_name"]); 
      $fd->setContentType($photo["type"]); 
      $entry->setMediaSource($fd); 

     $result = $entry->save($uri); 
      if ($result) { 
       outputPhotoFeed($client, $user, $albumId, $photoId);   
      } else { 
       echo "There was an issue with upating this photo."; 
      } 
    } 

...ほぼ正しかった作品、更新されたコード。

関連する問題