コード例 #1
0
 public function createPhoto($album)
 {
     $client = $this->photos;
     $fd = $client->newMediaFileSource('Zend/Gdata/_files/testImage.jpg');
     $fd->setContentType('image/jpeg');
     $photo = new Zend_Gdata_Photos_PhotoEntry();
     $photo->setMediaSource($fd);
     $photo->setTitle($client->newTitle("test photo"));
     $photo->setCategory(array($client->newCategory('http://schemas.google.com/photos/2007#photo', 'http://schemas.google.com/g/2005#kind')));
     $newPhoto = $client->insertPhotoEntry($photo, $album);
     $this->assertEquals($photo->getTitle(), $newPhoto->getTitle());
     $this->assertEquals($newPhoto->getTitle(), $client->getPhotoEntry($newPhoto->getLink('self')->href)->getTitle());
     $photoFeedUri = $newPhoto->getLink('http://schemas.google.com/g/2005#feed')->href;
     $photoFeed = $client->getPhotoFeed($photoFeedUri);
     $this->verifyProperty($photoFeed, "title", "text", "test photo");
     return $newPhoto;
 }
コード例 #2
0
ファイル: Photo.php プロジェクト: Neozeratul/Intermodels
 /**
  * Adicionar una nueva foto a un album especifico.
  *
  * @param  integer          $albumId   id del album
  * @param  array            $photo   The uploaded photo
  * @return Zend_Gdata_Photos_PhotoEntry
  */
 public function insertPhoto($albumId, $photo)
 {
     $fd = $this->_photos->newMediaFileSource($photo["tmp_name"]);
     $fd->setContentType($photo["type"]);
     $entry = new Zend_Gdata_Photos_PhotoEntry();
     $entry->setMediaSource($fd);
     $entry->setTitle($this->_photos->newTitle($photo["name"]));
     $entry->setSummary($this->_photos->newSummary($photo["summary"]));
     $albumQuery = new Zend_Gdata_Photos_AlbumQuery();
     $albumQuery->setAlbumId($albumId);
     $albumEntry = $this->_photos->getAlbumEntry($albumQuery);
     try {
         $photo = $this->_photos->insertPhotoEntry($entry, $albumEntry);
     } catch (Zend_Exception $e) {
         //echo $e->getMessage();
     }
     return $photo;
 }
コード例 #3
0
ファイル: Photos.php プロジェクト: jsnshrmn/Suma
/**
 * Adds a new photo to the specified album
 *
 * @param  Zend_Http_Client $client  The authenticated client
 * @param  string           $user    The user's account name
 * @param  integer          $albumId The album's id
 * @param  array            $photo   The uploaded photo
 * @return void
 */
function addPhoto($client, $user, $albumId, $photo)
{
    $photos = new Zend_Gdata_Photos($client);
    $fd = $photos->newMediaFileSource($photo["tmp_name"]);
    $fd->setContentType($photo["type"]);
    $entry = new Zend_Gdata_Photos_PhotoEntry();
    $entry->setMediaSource($fd);
    $entry->setTitle($photos->newTitle($photo["name"]));
    $albumQuery = new Zend_Gdata_Photos_AlbumQuery();
    $albumQuery->setUser($user);
    $albumQuery->setAlbumId($albumId);
    $albumEntry = $photos->getAlbumEntry($albumQuery);
    $result = $photos->insertPhotoEntry($entry, $albumEntry);
    if ($result) {
        outputAlbumFeed($client, $user, $albumId);
    } else {
        echo "There was an issue with the file upload.";
    }
}
コード例 #4
0
ファイル: move.php プロジェクト: shalinis34/Facebook-Albums
/**
 * Adds a new photo to the specified album
 *
 * @param  Zend_Http_Client $client  The authenticated client
 * @param  string           $user    The user's account name
 * @param  integer          $albumId The album's id
 * @param  array            $photo   The uploaded photo
 * @return void
 */
function addPhoto($client, $user, $albumId, $photo_name, $photo_path)
{
    $photos = new Zend_Gdata_Photos($client);
    $fd = $photos->newMediaFileSource($photo_path);
    $fd->setContentType('image/jpeg');
    $entry = new Zend_Gdata_Photos_PhotoEntry();
    $entry->setMediaSource($fd);
    $entry->setTitle($photos->newTitle($photo_name));
    $albumQuery = new Zend_Gdata_Photos_AlbumQuery();
    $albumQuery->setUser($user);
    $albumQuery->setAlbumId($albumId);
    $albumEntry = $photos->getAlbumEntry($albumQuery);
    $result = $photos->insertPhotoEntry($entry, $albumEntry);
    if ($result) {
        return $result;
    } else {
        echo "There was an issue with the file upload.";
    }
}
コード例 #5
0
ファイル: Picasa.php プロジェクト: Gouken/WebMuApp
 public static function upload($pic, $nameImage)
 {
     $cUrl = "";
     static::auth();
     $fd = static::$service->newMediaFileSource($pic["full_path"]);
     $fd->setContentType($pic["file_type"]);
     $entry = new Zend_Gdata_Photos_PhotoEntry();
     $entry->setMediaSource($fd);
     $entry->setTitle(static::$service->newTitle($nameImage));
     $albumQuery = new Zend_Gdata_Photos_AlbumQuery();
     $albumQuery->setUser("default");
     $albumQuery->setAlbumId(static::$albumID);
     $albumEntry = static::$service->getAlbumEntry($albumQuery);
     try {
         $insertedEntry = static::$service->insertPhotoEntry($entry, $albumEntry);
         if ($insertedEntry->getMediaGroup()->getContent() != null) {
             $mediaContentArray = $insertedEntry->getMediaGroup()->getContent();
             $wantReplace = "/" . $nameImage;
             $cUrl = @str_replace($wantReplace, "", $mediaContentArray[0]->getUrl());
             $cUrl = static::changelink($cUrl);
         }
         static::$status['error'] = false;
         static::$status['message'] = "Success !";
     } catch (Zend_Gdata_App_Exception $e) {
         //static::$status['message'] =$e->getMessage();
         $cUrl = NULL;
     }
     return $cUrl;
 }