/** * 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; }
public function updateSummary($idAlbum, $picId, $summary) { static::auth(); $gphoto = new Zend_Gdata_Photos(static::$client); $query = new Zend_Gdata_Photos_PhotoQuery(); $query->setUser("default"); $query->setAlbumId($idAlbum); $query->setPhotoId($picId); $query->setType("entry"); try { $photoEntry = static::$service->getPhotoEntry($query); $photoEntry->setSummary($gphoto->newSummary($summary)); $photoEntry->save(); static::$status['error'] = false; static::$status['message'] = "Success !"; } catch (Zend_Gdata_App_Exception $e) { static::$status['message'] = $e->getMessage(); } return static::$status; }