/** * Update the meta data associated with the specified album. * The fields identified by each parameter can be modified, however * which photos appear in an album are not. Any parameters left null will remain their current value. * * @access public * @param string $username The username on the account that the album is in. * @param string $albumid The id number of the album to update. * @param string $title The title to assign to this album. Optional, the default is null. * @param string $summary A summary of the contents of the album. Optional, the default is an empty string. * Optional, the default is null. * @param string $icon The image that appears as the album cover. Optional, the default is null. * @param string $rights The access rights to assign to the album. Options are "public" and "private". Optional, * the default is "public". Optional, the default is null. * @param string $commentingEnabled Identifies whether or not other users should be allowed to post comments to images * in the new album. Optional, the default is "true". Optional, the default is null. * @param string $location The location that the images in the album were taken. Optional, the default is an empty string. * @param string $timestamp The number of miliseconds after the Unix epoch (January 1, 1970) that the photos in the album were * taken. Notice that the PHP time() functions returns the number of seconds since the epoch, so * that number has to be multiplied by 1000 to be used for this parameter. Optional, the default is * null. * @param string $gmlPosition The location in the world that this image was taken. The format is latitude and longitude, * separated by a space. Optional, the default is null. * @return Picasa_Album The album that was updated. * @throws {@link Picasa_Exception} If something was wrong with the post to Picasa. A specific subclass of * {@link Picasa_Exception} will be thrown based on what kind of problem was * encountered, unless the type of error was unknown, in which case {@link Picasa_Exception} * itself will be thrown. */ public function updateAlbum($username, $albumid, $title = null, $summary = null, $icon = null, $rights = null, $commentingEnabled = null, $location = null, $timestamp = null, $gmlPosition = null) { $album = $this->getAlbumByIdAsEntry($username, $albumid); /** * It's possible that I can just leave all of these parameters out of the XML, but Picasa's documentation * states that you cannot update just part of an album. Preliminary tests have proved that at least I don't know * what that means. Anyway, this would be reimplimented and tested if I had more time. */ if ($title == null) { $title = $album->getTitle(); } if ($summary == null) { $summary = $album->getSummary(); } if ($rights == null) { $rights = $album->getRights(); } if ($commentingEnabled == null) { $commentingEnabled = $album->getCommentingEnabled(); } if ($location == null) { $location = $album->getLocation(); } $data = Picasa::constructAlbumXML($title, $summary, $icon, $rights, $commentingEnabled, $location, $timestamp, $gmlPosition, $album->getIdnum()); $path = $album->getEditLink(); $path = substr($path, strlen("http://" . Picasa::$PICASA_URL)); $host = Picasa::$PICASA_URL; $header = array(1 => $this->getAuthHeader()); try { Picasa::do_request($host, $path, $data, "PUT", $header, "application/atom+xml"); } catch (Picasa_Exception $e) { throw Picasa::getExceptionFromInvalidPost($e->getResponse(), $e->getMessage()); } try { $retObj = $this->getAlbumById($username, $albumid); } catch (Picasa_Exception $e) { throw new Picasa_Exception("The album was successfully updated but then the following error was encountered: " . $e->getMessage(), $e->getResponse(), $e->getUrl()); } return $retObj; }