コード例 #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
 /**
  * Añade una foto cargada (Zend_Gdata_Photos_PhotoFeed)
  * al modelo Photo.
  *
  * @param  Zend_Gdata_Photos_PhotoEntry          $picasaPhoto
  * @return Photo
  */
 public static function setPhoto($picasaPhoto)
 {
     $foto = new Photo();
     try {
         $original = $picasaPhoto->getMediaGroup()->getContent();
         $thumbnail = $picasaPhoto->getMediaGroup()->getThumbnail();
         $foto->photo_id = $picasaPhoto->getGphotoId();
         $foto->original = $original[0]->getUrl();
         $foto->descripcion = $picasaPhoto->getMediaGroup()->getDescription();
         $foto->thumbnail_1 = $thumbnail[0]->getUrl();
         $foto->thumbnail_2 = $thumbnail[1]->getUrl();
         $foto->thumbnail_3 = $thumbnail[2]->getUrl();
         $foto->save();
         return $foto;
     } catch (Zend_Exception $e) {
     }
 }
コード例 #3
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;
 }
コード例 #4
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.";
    }
}
コード例 #5
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.";
    }
}
コード例 #6
0
 /**
  * Delete a PhotoEntry.
  *
  * @param Zend_Gdata_Photos_PhotoEntry $photo The photo entry to
  *          delete.
  * @param boolean $catch Whether to catch an exception when
  *            modified and re-delete or throw
  * @return void.
  * @throws Zend_Gdata_App_Exception
  * @throws Zend_Gdata_App_HttpException
  */
 public function deletePhotoEntry($photo, $catch)
 {
     if ($catch) {
         try {
             $this->delete($photo);
         } catch (Zend_Gdata_App_HttpException $e) {
             if ($e->getResponse()->getStatus() === 409) {
                 $entry = new Zend_Gdata_Photos_PhotoEntry($e->getResponse()->getBody());
                 $this->delete($entry->getLink('edit')->href);
             } else {
                 throw $e;
             }
         }
     } else {
         $this->delete($photo);
     }
 }
コード例 #7
0
ファイル: Picasa.php プロジェクト: s-kalaus/zkernel
 function _insertPhoto($data)
 {
     $s = @getimagesize($data['image_url']);
     $fd = $this->_service->newMediaFileSource($data['image_url']);
     $fd->setContentType(@$s['mime']);
     $entry = new Zend_Gdata_Photos_PhotoEntry();
     $entry->setMediaSource($fd);
     $entry->setGphotoTimestamp($this->_service->newTimestamp((string) strtotime($data['date']) . '000'));
     //$entry->setTitle($this->_service->newTitle($data['description']));
     $query = new Zend_Gdata_Photos_AlbumQuery();
     $query->setAlbumId($data['parentid']);
     $album = $this->_service->getAlbumEntry($query);
     $entry = $this->_service->insertPhotoEntry($entry, $album);
     return $entry ? $entry->getGphotoId() : false;
 }
コード例 #8
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;
 }