示例#1
0
 /**
  * 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;
 }
示例#2
0
/**
 * 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.";
    }
}
示例#3
0
文件: Photos.php 项目: jsnshrmn/Suma
/**
 * Deletes 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
 * @return void
 */
function deleteAlbum($client, $user, $albumId)
{
    $photos = new Zend_Gdata_Photos($client);
    $albumQuery = new Zend_Gdata_Photos_AlbumQuery();
    $albumQuery->setUser($user);
    $albumQuery->setAlbumId($albumId);
    $albumQuery->setType('entry');
    $entry = $photos->getAlbumEntry($albumQuery);
    $photos->deleteAlbumEntry($entry, true);
    outputUserFeed($client, $user);
}