Class Picasa

Description

The primary class for interactions with Picasa.

This class was developed in order to let PHP Picasa developers stay away from the low-level query building and request sending. The Picasa class handles authorizations, including both AuthSub and Client Login authorization establishment and management. It also handles retrieving of image data from Picasa Web Albums, storing the information in classes inside the Picasa subfolder. Additionally, photo posting, updating, and deleting is all made easy through the Picasa class. Essentially just determine what verb you want to do ("get", "post", "delete", or "update"), then figure out what noun you want to perform the verb on ("album", "image", "tag", or "comment"). If you put the two words together, chances are good that you will find the method you want. For instance, to *post* an *image*, you call Picasa::postImage(). Provide the attributes of the image as parameters in the method and the photo will be created as a Picasa Web Album.

In addition to utility methods, this class stores authorization information once an instance has been authorized. For persistence, since there is no caching mechanism with this API, this class has methods for storing and retrieving an authorization session from the user's cookies.

Because this class attempts to be so high level, not every single piece of Picasa's functionality options can be offered. This API should cover a huge percentage of desired functionality. However, in case there is something offered by Picasa's Data API that is not offered through this API, the class was made to be easily extendible. For instance, if Picasa one day offers the ability to upload videos and the latest version of this API does not offer video uploads, a PHP programmer could write a class that extends the Picasa class and would have access to all the methods for managing authorizations and posting and retrieving data. Additionally, there are generic PHP methods such as Picasa::do_request() that are useful for performing operations that would normally be handled by an installed PHP package. These classes are also protected rather than private, so they can be used by classes that extend this one, making your own extensions to this API easily doable.

  • author: Cameron Hinkle
  • version: Version 3.0
  • copyright: Copyright (c) 2008 Cameron Hinkle
  • since: Version 3.0
  • license: GNU Public License Version 3

Located in /Picasa.php (line 52)


	
			
Variable Summary
static string $AUTH_TYPE_AUTH_SUB
static string $BASE_ENTRY_QUERY_URL
static string $BASE_MEDIA_QUERY_URL
static string $BASE_QUERY_URL
static string $PICASA_URL
string $auth
int $authType
string $emailAddress
Method Summary
static string buildQueryParams ([int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [string $visibility = null], [int $thumbsize = null], [int $imgmax = null], [string $location = null], [string $sortDescending = null], [string $boundingBox = null])
static string constructAlbumXML (string $title, [string $summary = ""], [string $icon = null], [string $rights = "public"], [boolean $commentingEnabled = "true"], [string $location = ""], [string $timestamp = null], [string $gmlPosition = null], [string $albumid = null])
static string constructImageXML (string $title, [string $summary = ""], [string $keywords = null], [string $commentingEnabled = "true"], [string $timestamp = ""], [string $gmlPosition = null])
static string do_request (string $host, string $path, string $data, string $request, [array $specialHeaders = null], [string $type = "application/x-www-form-urlencoded"], [string $protocol = ""], [int $port = "80"])
static Picasa_Exception getExceptionFromInvalidPost (string $buf, [string $message = null])
static Picasa_Exception getExceptionFromInvalidQuery (string $url, array $contextArray)
static $string getResponseValue (string $response, string $key)
static string getUrlToLoginPage (string $next, [int $session = 1])
static void redirectToLoginPage (string $next, [int $session = 1])
Picasa __construct ([string $authToken = null], [int $authType = null], [array $contextArray = null])
boolean authorizeFromCookie ()
string authorizeWithAuthSub ([string $token = null], [boolean $saveAuthorizationToCookie = true], [int $expires = 2592000])
string authorizeWithClientLogin (string $emailAddress, string $password, [string $source = null], [string $loginToken = null], [string $loginCaptcha = null], [boolean $saveAuthorizationToCookie = true], [int $expires = 2592000], [string $service = "lh2"])
array constructContextArray ([boolean $doAuth = false], [string $method = "GET"], [int $contentLength = 0], [string $contentType = "application/x-www-form-urlencoded"])
{@link copyAlbum (string $destinationUsername, Picasa_Album $album)
{@link copyImage (string $destinationUsername, string $destinationAlbumId, Picasa_Image $image)
boolean deauthorize ()
boolean deleteAlbum (string $username, string $albumid)
boolean deleteComment (string $username, string $albumid, string $imageid,  $commentid, string $tag)
boolean deleteImage (string $username, string $albumid, string $imageid)
boolean deleteTag (string $username, string $albumid, string $imageid, string $tag)
Picasa_Album getAlbumById (string $username, string $albumid, [int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [int $thumbsize = null], [int $imgmax = null])
void getAlbumByIdAsEntry (string $username, string $albumid)
Picasa_Account getAlbumsByUsername (string $username, [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"], [int $thumbsize = null], [int $imgmax = null])
string getAuthHeader ()
string getAuthToken ()
int getAuthType ()
Picasa_Image getCommentById (string $username, string $albumid, string $imageid, string $commentid)
array getCommentsByUsername (string $username, [string $albumid = null], [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"])
array getContactsByUsername (string $username)
resource getContext ()
array getContextArray ()
Picasa_Image getImageById (string $username, string $albumid, string $imageid, [int $thumbsize = null], [int $imgmax = null])
Picasa_Image getImageByIdAsEntry (string $username, string $albumid, string $imageid)
Picasa_ImageCollection getImages ([string $username = null], [int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [string $visibility = null], [int $thumbsize = null], [int $imgmax = null], [string $sortDescending = true], [string $boundingBox = null], [string $location = null])
array getTagsByUsername (string $username, [string $albumid = null], [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"])
boolean isAuthenticated ()
Picasa_Album postAlbum (string $username, string $title, [string $summary = ""], [string $rights = "public"], [string $commentingEnabled = "true"], [string $location = ""], [string $timestamp = null], [string $icon = null], [string $gmlPosition = null])
Picasa_Comment postComment (string $username, string $albumid, string $imageid, string $comment)
Picasa_Image postImage (string $username, string $albumid, string $locationOnDisk, string $type, string $title, [string $summary = ""], [string $keywords = ""], [string $commentingEnabled = "true"], [string $timestamp = null], [string $gmlPosition = null])
Picasa_Image postTag (string $username, string $albumid, string $imageid, string $tag)
boolean saveAuthToCookie ([int $expires = 2592000])
void setAuthorizationInfo (string $authToken, string $authType)
Picasa_Album updateAlbum (string $username, string $albumid, [string $title = null], [string $summary = null], [string $icon = null], [string $rights = null], [string $commentingEnabled = null], [string $location = null], [string $timestamp = null], [string $gmlPosition = null])
Picasa_Image updateImage (string $username, string $albumid, string $imageid, [string $title = null], [string $summary = null], [string $keywords = null], [string $commentingEnabled = null], [string $timestamp = null], [string $gmlPosition = null], [string $newImageLocation = null], [string $type = null])
string __toString ()
Variables
static string $AUTH_TYPE_AUTH_SUB = 3 (line 111)

A number designated to represeting the AuthSub method for Authorizing an object.

There is no significance to the number assigned to this variable.

  • access: public
static int $AUTH_TYPE_CLIENT_LOGIN = 2 (line 101)

A number designated to represeting the Client Login method for Authorizing an object.

There is no significance to the number assigned to this variable.

  • access: public
static string $BASE_ENTRY_QUERY_URL = 'http://picasaweb.google.com/data/entry/api' (line 81)

The base for queries that use the "entry" path instead of the "feed" path. It's not clear what differentiates this path from the path in Picasa::$BASE_QUERY_URL, but the documentation makes it clear when each is necessary.

  • access: protected
static string $BASE_MEDIA_QUERY_URL = 'http://picasaweb.google.com/data/media/api' (line 91)

The base for queries that use the "media" path instead of the "feed" path. This path is required for updating the binary data in an image.

  • access: protected
static string $BASE_QUERY_URL = 'http://picasaweb.google.com/data/feed/api' (line 70)

The base for a standard query. All non-authenticated queries begin with this string.

  • access: protected
static string $COOKIE_NAME_AUTH_SUB_TOKEN = 'auth_sub_token' (line 120)

The title of the cookie to use when setting and retrieving an AuthSub token from a user's Cookies.

  • access: public
static string $COOKIE_NAME_CLIENT_LOGIN_TOKEN = 'client_login_token' (line 129)

The title of the cookie to use when setting and retrieving an Client Login token from a user's Cookies.

  • access: public
static string $PICASA_URL = 'picasaweb.google.com' (line 61)

The Url, without the protocol, of Picasa Web.

  • access: protected
string $auth (line 151)

A token supplied by Google after a successful attempt to authorize this object.

The Auth Token is like a Golden Ticket for doing operations that require authorization.

  • access: private
int $authType (line 176)

The type of authorization that has been used to authenticate this instance.

It must either be Picasa::$AUTH_TYPE_AUTH_SUB or Picasa::$AUTH_TYPE_CLIENT_LOGIN. The auth type is required because the authorization header has to be formatted differently depending on what type of authorization was used.

array $contextArray (line 163)

An array that is in an acceptable format for the php function stream_context_create() to create a context.

For an authorized instance, this array holds the HTTP header with the authorization information necessary to make authenticated requests. It is useful to have because it holds both the authorization token as well as the authorization type in the same object.

string $emailAddress (line 141)

The email address or username that this instantiation is associated with.

The field isn't currently used for anything because the username is never captured when using AuthSub authentication, and it's not required when executing requests that require authentication.

  • access: private
Methods
static method buildQueryParams (line 1909)

Constructs a string of optional query parameters for requesting a feed from Picasa.

All parameters are optional, their defaults are all null. Passing a null value for a parameter will exclude the value from the parameter list.

  • return: A string with optional query parameters strung together with ampersands.
  • access: protected
static string buildQueryParams ([int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [string $visibility = null], [int $thumbsize = null], [int $imgmax = null], [string $location = null], [string $sortDescending = null], [string $boundingBox = null])
  • int $maxResults: The maximum number of results to return.
  • int $startIndex: The first element number with the search results to return. Useful for pagination.
  • string $keywords: Space-delimited list of keywords to search for.
  • string $tags: Space-delimited list of tags to search for.
  • string $visibility: Restrict the search to comments in images with the access rights specified here.
  • int $thumbsize: Comma-delimited list of thumbnail sizes to fetch.
  • int $imgmax: Size of image to return in the $content field of the Picasa_Image field.
  • string $location: Named location to search for photos in. For example, London.
  • string $sortDescending: Whether or not to sort the items returned by date added descending.
  • string $boundingBox: Geo coordinates to search for photos within in the order west, south, east, north.
static method constructAlbumXML (line 1811)

Generates the XML necessary for creating a Picasa Web Album.

  • return: The XML for uploading the described album.
  • access: protected
static string constructAlbumXML (string $title, [string $summary = ""], [string $icon = null], [string $rights = "public"], [boolean $commentingEnabled = "true"], [string $location = ""], [string $timestamp = null], [string $gmlPosition = null], [string $albumid = null])
  • string $title: The title to assign to the created album.
  • string $summary: A summary to assign to the created album. Optional, the default is an empty string.
  • string $icon: The image that appears as the album cover.
  • string $rights: The rights to assign to the created album. This value must be "private" or "public". Optional, the default is "public".
  • boolean $commentingEnabled: true allows logged in users to post comments in this album. false disallows all commenting. Optional, the default is true.
  • string $location: The location that the photos in the album were taken. Optional, the default is an empty string.
  • 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. Passing null here will set the timestamp to the current time.
  • 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.
  • string $albumid: The id number of the album. This is applicable if the XML is being built to update an existing album.
static method constructImageXML (line 1861)

Generates the XML necessary for creating a Picasa image.

  • return: XML that can be sent to Picasa to create an image.
  • access: protected
static string constructImageXML (string $title, [string $summary = ""], [string $keywords = null], [string $commentingEnabled = "true"], [string $timestamp = ""], [string $gmlPosition = null])
  • string $title: The title that the image will be given.
  • string $summary: A summary of what is in the image. Optional, the default is an empty string.
  • string $keywords: A comma-delimited list of keywords associated with the image. Optional, the default is null.
  • string $commentingEnabled: Set to true if other users should be able to comment on the image and false if they shouldn't. Optional, the default is true.
  • string $timestamp: The number of miliseconds after the Unix epoch (January 1st, 1970) that the image was taken (roughly).
  • 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.
static method do_request (line 1990)

Executes a request.

This is a pretty generic PHP function for the most part. The only parts that are specific to Picasa is the errors that are thrown. PHP doesn't have a built in function that does this very well (although there are packages for it that can be installed), so this manually sets the HTTP headers and parses the whole response.

  • return: The entire response, including headers, that was recieved from the host.
  • throws: Picasa_Exception If a response of "200" or "201" is not recieved. In this case, the entire contents of the response, including headers, is set to the $response field of the exception and the error supplied by Picasa is set as the exceptions message. The idea is that the calling method can search the response for a specific return code (for instance, a File Not Found or Forbidden error) and throw a more specific exception. The caller can also search the response for values that are specific to its request, such as a Captcha URL.
  • access: protected
static string do_request (string $host, string $path, string $data, string $request, [array $specialHeaders = null], [string $type = "application/x-www-form-urlencoded"], [string $protocol = ""], [int $port = "80"])
  • string $host: The destination address to send the request to. It should not include a protocol.
  • string $path: The path on the host to send the request to. It should start with a "/"
  • string $data: Any data that should be sent along with the request. If there is no data, leave it as null.
  • string $request: The type of request to perform. Most common are GET, POST, PUT, and DELETE. The type of request to use for each Picasa function is defined in Picasa's official documentation.
  • array $specialHeaders: An array of strings of headers that should be sent with the request. The headers that are always sent are Host, Content-Type, and Content-Length. The most common type of special header is an authorization header from Google. Note that even if there is only one special header, it still must be in an array. Also note that each line in the array should end in "\r\n" and should be set in the array with double quotes, not single quotes, because "\r\n" is interpreted differently by PHP if single quotes are used. Optional, the default is null.
  • string $type: The type of content that will is being sent through the request. Optional, the default is "application/x-www-form-urlencoded".
  • string $protocol: The protocol to use when sending the request. Secure requests should use "ssl://". Note that the protocol must end in "://" unless it's an empty string. For HTTP, this parameter can be left as an empty string. Optional, the default is an empty string.
  • int $port: The port number to send the request to. Different protocols have different port numbers. HTTP protocol uses port 80 and SSL uses port 443. Optional, the default is 80.
static method getExceptionFromInvalidPost (line 1733)

Matches the supplied $buf contents against several different HTTP response codes to determine what kind of Picasa_Exception to return.

Note that this does not actually throw an exception, it just determines what kind of exception could be thrown based on the response. It's up to the caller to actually throw the exception.

The name of this method is a little misleading; the response does not need to be from a POST, it can be a response from any kind of request.

  • return: A type of Picasa_Exception depending on what response code was found. If the response code is not recognized, then a Picasa_Exception itself is thrown.
  • access: public
static Picasa_Exception getExceptionFromInvalidPost (string $buf, [string $message = null])
  • string $buf: The HTTP response to check for the response code in.
  • string $message: The message to set in the exception. Optional, the default is null. If null is supplied, a default message will be set based on what type of response code is sent.
static method getExceptionFromInvalidQuery (line 1669)

Executes a GET request on the $url passed in and traps the error code to pass with the exception.

This is necessary because queries in this API are executed using http://www.php.net/file_get_contents typically, which does not supply the response code in the case of a response greater than 201 (it considers the file nonexistant in such a case and just returns false). With this message, the client can get a useful error message that actually comes from Picasa.

Note that this does not actually throw an exception, it just determines what kind of exception could be thrown based on the response. It's up to the caller to actually throw the exception.

  • return: If the response was empty.
  • access: public
static Picasa_Exception getExceptionFromInvalidQuery (string $url, array $contextArray)
  • string $url: The URL to request, including the host and path.
  • array $contextArray: The context array that was passed with the original request. This is so that a different request is not executed when this method is called, thus resulting in a different error message.
static method getResponseValue (line 2070)

Looks in the supplied response for the supplied key and finds the value associated with the key if one exists.

Searches between the supplied key and the first linebreak. The value searched for cannot have a linebreak in it.

  • return: The value associated with the key. The value will be the string between the key with an equals sign next to it, and the end of the line. Returns null if no value is found.
  • access: protected
static $string getResponseValue (string $response, string $key)
  • string $response: The haystack to look for the key in.
  • string $key: The needle to look for in the haystack.
static method getUrlToLoginPage (line 583)

Constructs the URL that the user should be redirected to in order to be authorized with the AuthSub method.

The URL is a page hosted by Google that will allow the user to login to his Picasa Account. When the user returns to the client domain (specified in the $next parameter), a token supplied, appended to the URL. Retrieving that token (using PHP's "$_GET" superglobal; the key is "token") and pass it to authorizeWithAuthSub to enable requests for the user that were previously disabled, such as posting photos and accessing private albums.

  • return: The URL that the user should be redirected to in order to log in to their Picasa account.
  • access: public
static string getUrlToLoginPage (string $next, [int $session = 1])
  • string $next: The URL that the user should be redirected to once they have logged into their account.
  • int $session: Must be either 1 or 0. This indicates if the login should be transferable to a session token, which is valid for a long time, wherease the default token is only useable once.
    1. to enable session tokens, 0 to disable.
static method redirectToLoginPage (line 562)

Redirects the user to Google's AuthSub login page so that they can login to access restricted functions.

The URL in the $next parameter must be registered with Google. At the URL specified there, the "token" value must be pulled from the request and passed to {@see Picasa::authorizeWithAuthSub()} for the authorization to be complete.

  • access: public
static void redirectToLoginPage (string $next, [int $session = 1])
  • string $next: The URL that the user should be redirected to after visiting the login page. This URL must be registered with Google in advance. See http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html.
  • int $session: Must be either 1 or 0. This indicates if the login should be transferable to a session token, which is valid for a long time, wherease the default token is only useable once.
    1. to enable session tokens, 0 to disable.
Constructor __construct (line 197)

The constructor allows the instantiation of an unauthorized or authorized Picasa object.

All fields can be left blank for an unauthorized instantiation. If an unauthorized instantiation is created, the object can later be authorized using setAuthorizationInfo(), authorizeWithClientLogin(), or authorizeWithAuthSub().

Picasa __construct ([string $authToken = null], [int $authType = null], [array $contextArray = null])
  • string $authToken: An string representing an authorization issued by Google. If a valid token is supplied, certain requests that are not allowed for unathorized objects are allowed. Optional, the default is null.
  • int $authType: An integer indicating what type of authorization was used. Options are restricted to Picasa::$AUTH_TYPE_CLIENT_LOGIN and Picasa::$AUTH_TYPE_AUTH_SUB. If the $authToken is not null, this field has to be supplied. Optional, default is null.
  • array $contextArray: The context array holds header information and can contain authorization information in the headers. Optional, the default is null.
authorizeFromCookie (line 1600)

Fetches the authorization token from the user's cookies- if one exists- and logs the user in using the retrieved token.

It automatically determines which type of authorization (AuthSub or Client Login) to use based on the type of cookie that is retrieved. If both types exist in the users' cookies, the default is AuthSub.

  • return: true if setting the authorization information in the cookie was successful, false otherwise.
  • access: public
boolean authorizeFromCookie ()
authorizeWithAuthSub (line 426)

Authorizes the current object with Google's AuthSub authorization method, described in Google's documentation

(http://code.google.com/apis/accounts/docs/AuthForWebApps.html). With this method, the user has to have been redirected to a Google login page (redirectToLoginPage()) and granted access to your application to access their private data. This method should be called on the page that the user is directed to after he logs in. This method will always convert the token recieved from a single use token to a session token (for your convenience).

This method will return the authorization token returned from Google. However, the current object is automatically authenticated when this method executes successfully and that token is automatically saved in the Picasa:$auth field. The returned token is probably not useful in many cases, but there wasn't anything better to return.

string authorizeWithAuthSub ([string $token = null], [boolean $saveAuthorizationToCookie = true], [int $expires = 2592000])
  • string $token: An authorization token supplied by Picasa in a URL parameter called "token" after the user logs in through the Google-hosted login page. Optional, the default is null. If null is passed, the token is taken from the $_GET superglobal.
  • boolean $saveAuthorizationToCookie: If true, the returned authentication token is saved to the user's cookie. If false, just stores the token in the $auth field of the current object. Optional, default is true.
  • int $expires: The number of seconds after the current time that the cookie should remain in the user's browser for. Optional, default is 2592000 (30 days).
authorizeWithClientLogin (line 357)

Authorizes a Google email address through the Client Login method, described in Google's documentation (http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html). This allows special functions such as posting images and comments.

On a successful authorization, true is returned and the $auth private member is set to the authorization string returned by Google. If the authorization attempt fails, false is returned, and the $error private member is set to the error code returned by Google. Possible error codes can be found at the URL listed above.

  • return: The authorization token returned by Google.
  • link: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
  • throws: Picasa_Exception A more generic exception if a different type of error occurs.
  • throws: Picasa_Exception_CaptchaRequiredException If the response from Google indicates that a CAPTCHA challenge is required.
  • throws: Picasa_Exception_InvalidUsernameOrPasswordException If either the username or password that was supplied was invalid.
  • access: public
string authorizeWithClientLogin (string $emailAddress, string $password, [string $source = null], [string $loginToken = null], [string $loginCaptcha = null], [boolean $saveAuthorizationToCookie = true], [int $expires = 2592000], [string $service = "lh2"])
  • string $emailAddress: The email address of the account that is going to be authorized. Can also just be the user's Google username.
  • string $password: The account's password, required for authorization.
  • string $source: The source, which is a three part string. This string should take the form: "companyName-applicationName-versionID". Optional, the default is null.
  • string $loginToken: The token returned by Google when the CAPTCHA challenge was requested. Use Picasa_Exception_CaptchaRequiredException::getCaptchaToken() to get this value. If the client is not responding to a Captcha challenge, leave this null. Optional, the default is null.
  • string $loginCaptcha: The text input by the user representing the CAPTCHA challenge presented to them. If the client is not responding to a Captcha challenge, leave this null. Optional, the default is null.
  • boolean $saveAuthorizationToCookie: If this is true, the authorization token returned from Google is stored in the users' browser cookie so that it can be retrieved later and the user can be logged in without have to enter his email address and password (assuming the cookie and token both do not expire. false will only store the token in the current instance, which is not persistent and disapears as soon as the page loads. Optional, the default is true.
  • int $expires: The number of seconds after the cookie is set that it should expire. If $saveAuthorizationToCookie is false, this parameter is ignored. Optional, the default is 2,592,000 seconds (30 days).
  • string $service: The service that the account is being authorized for. Each service has a different service code. The code for Picasa is lh2, which is the default.
clearAuthentication (line 309)

Clears authentication fields in the object and sets the header information back to the default, non-autenticated version.

Also clear the authorization out of the user's cookie. It essentially logs them out.

  • access: public
void clearAuthentication ()
constructContextArray (line 1633)

Builds a context array from the authorization information in the current instantiation.

This context array is used in several places, including the constructors for Picasa_Image and Picasa_Album. The context array is built in such a way that it can be passed to PHP {@see stream_context_create()} to be used in GET requests.

array constructContextArray ([boolean $doAuth = false], [string $method = "GET"], [int $contentLength = 0], [string $contentType = "application/x-www-form-urlencoded"])
  • boolean $doAuth: true if the authorization information should be included in the array, false otherwise. Sometimes it may be desireable to do an unauthorized request for information from Picasa even when the client has established authorization. Optional, the default is false.
  • string $method: The request type that will be used. This context array in practice is typically only used directly for the method {@see file_get_contents()}, which is a get request, so it is probably always correct to pass "GET" here, which is the default value.
  • int $contentLength: The size of the data in the request. For "GET" requests, this can be 0, which is the default.
  • string $contentType: The type of content being sent in the request. Optional, the default is application/x-www-form-urlencoded.
convertFromSingleUseToSessionToken (line 485)

When authorizing with AuthSub, Picasa initially issues a single-use token, which can only be used once.

This method will convert that single use token into a session token, which will remain valid for a very long time.

  • return: The authorization token returned from Google.
  • throws: Picasa_Exception If something was wrong with the request to Picasa. In this case the token will not be converted. An exception subclass that is specific to the error encountered will be thrown, so the client can catch the individual subclasses and respond accordingly.
  • access: public
string convertFromSingleUseToSessionToken ()
copyAlbum (line 1551)

Copies the album attributes along with all images in the album to a new username.

This requires that the current object be authorized to post images to the destination username's account. Tags are copied along with each image, however comments are not. It's the caller's responsibility to make sure the album passed in is what they want copied; keep in mind that some Picasa functions that fetch albums do not always return all the fields of an image so the parts that are left out are fetched when their getter is called. For instance an album returned by Picasa.getAlbumsByUsername() will not contain the images in it until getImages() is called on it.

  • return: Picasa_Album} The new album.
  • throws: Picasa_Exception If the user is not authorized to create albums or upload images to the destination account.
  • access: public
{@link copyAlbum (string $destinationUsername, Picasa_Album $album)
  • string $destinationUsername: The username of the account that the album will be copied to.
  • {@link $album: Picasa_Album) The album to copy. This is the album object and not just the album id.
copyImage (line 1577)

Copies an image with most attributes from one album to the other.

This requires that the current object be authorized to post images to the destination username's account. Most attributes, including tags, are copied, although comments are not.

  • return: Picasa_Image} The newly copied image.
  • throws: Picasa_Exception If the user is not authorized to create albums or upload images to the destination account.
  • access: public
{@link copyImage (string $destinationUsername, string $destinationAlbumId, Picasa_Image $image)
  • string $destinationUsername: The username for the account the image will be copied to.
  • string $destinationAlbumId: The id of the album the image will be copied to.
  • {@link $image: Picasa_Image} $image The image to copy. This is the image object and not just the image id.
deauthorize (line 510)

If the current instantiation is authorized using the "AuthSub" method, this actively invalidates the token.

  • return: true if the authorization was successfully deactivated. false if it was not.
  • throws: Picasa_Exception If the current instantiation is not authorized with AuthSub.
  • access: public
boolean deauthorize ()
deleteAlbum (line 1432)

Delete an entire album from Picasa Web Albums.

All images and information associated with the album will be deleted and is not recoverable (so be careful!).

  • return: True if the album was successfully deleted from Picasa.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown. In the case of an exception, the album is not deleted.
  • access: public
boolean deleteAlbum (string $username, string $albumid)
  • string $username: The username on the account that the album is in.
  • string $albumid: The id number of the album to delete.
deleteComment (line 1522)

Deletes a comment applied to a specific image in Picasa Web Albums.

  • return: true if the comment was successfully deleted.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown. In the case of an exception, the album is not deleted.
  • access: public
boolean deleteComment (string $username, string $albumid, string $imageid,  $commentid, string $tag)
  • string $username: The username on the account that the comment is in.
  • string $albumid: The id number of the album that the comment to delete is in.
  • string $imageid: The id number of the image that the comment is on.
  • string $tag: The id number of the comment to delete.
  • $commentid
deleteImage (line 1462)

Deletes an image from a Picasa Web Album.

The image and information associated with it will be deleted and is not recoverable (so be careful!).

  • return: True if the image was successfully deleted from Picasa.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown. In the case of an exception, the album is not deleted.
  • access: public
boolean deleteImage (string $username, string $albumid, string $imageid)
  • string $username: The username on the account that the image is in.
  • string $albumid: The id number of the album that the image to delete is in.
  • string $imageid: The id number of the image to delete.
deleteTag (line 1494)

Deletes a tag applied to a specific image.

Beware that Picasa does not throw an error if the client attempts to delete a tag that does not exist, so the client will have to do error checking on its own. If an album or image that does not exist is supplied, an error will be thrown.

  • return: true if the tag was successfully deleted.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. This includes if an invalid album or image was specified, but not if an invalid tag name was specified.
  • access: public
boolean deleteTag (string $username, string $albumid, string $imageid, string $tag)
  • string $username: The username on the account that the tag is in.
  • string $albumid: The id number of the album that the tag to delete is in.
  • string $imageid: The id number of the image that the tag is on.
  • string $tag: The title of the tag to delete.
getAlbumById (line 735)

Retrieves the Picasa web album with the specified id.

The album will contain all images that meet the specified criteria and is in the specified album. Passing null for any of the parameters will leave it up to Picasa to define the default values.

  • return: An object representing the album with the supplied id. Only photos in the album that meet the parameters passed into this method will be included in the album. This way, you can (for isntance) search for tags and keywords within an album.
  • link: http://code.google.com/apis/picasaweb/reference.html#Parameters
  • throws: Picasa_Exception If the request was somehow invalid. This could mean that the requested object does not have permission to retrieve the feed or the parameters supplied are not allowed by Picasa, or a number of other possible errors. A subclass of Picasa_Exception will be thrown, which will indicate specifically what the problem was with the request.
  • access: public
Picasa_Album getAlbumById (string $username, string $albumid, [int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [int $thumbsize = null], [int $imgmax = null])
  • string $username: The username on the account that the album is in.
  • string $albumid: The id number of the desired album.
  • int $maxResults: The maximum number of results to return. Optional, the default is null.
  • int $startIndex: The first element number with the search results to return. Useful for pagination. Optional, the default is null.
  • string $keywords: Space-delimited list of keywords to search for. Title and description are included in the search. Optional, default is an empty string.
  • string $tags: Space-delimited list of tags to search for. Only images with all tags in the list are included in the search results. Optional, default is empty string.
  • int $thumbsize: Comma-delimited list of thumbnail sizes to fetch. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800. URLs for the corresponding thumbnails are stored in the $thumbUrlMap of the Picasa_Image class. Optional, default is null. The default value will let Picasa choose the thumbnail sizes, which are stored in the $smallThumb, $mediumThumb, and $largeThumb fields of the Picasa_Image class.
  • int $imgmax: Size of image to return in the $content field of the Picasa_Image field. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600. Only values of 800 and less are displayable within a <a> HTML tag, all other values can only be downloaded directly through the user's browser. Optional, default value is null. The default value will let Picasa determine the size to return, which will not be useable within a <a> tag.
getAlbumByIdAsEntry (line 773)

Retrieves an Album as an Entry as opposed to a Feed.

Picasa's data api makes a distinction between the two. The two different types will sometimes contain different fields. This method should only be used if you are sure that the field you need is not accessible through a feed, only through an entry. It is declared protected so that client code cannot call it directly, only extensions of the Picasa class.

void getAlbumByIdAsEntry (string $username, string $albumid)
  • string $username: The username on the account that the album is in.
  • string $albumid: The id number of the desired album.
getAlbumsByUsername (line 619)

Retrieves a list of Picasa Albums contained within a Picasa_Account object based on the criteria supplied.

Passing null for any of the parameters will leave it up to Picasa to define the default values.

  • return: An Account including all albums within the specified user's account.
  • link: http://code.google.com/apis/picasaweb/reference.html#Parameters
  • throws: Picasa_Exception If the request was somehow invalid. This could mean that the requested object does not have permission to retrieve the feed or the parameters supplied are not allowed by Picasa, or a number of other possible errors. A subclass of Picasa_Exception will be thrown, which will indicate specifically what the problem was with the request.
  • access: public
Picasa_Account getAlbumsByUsername (string $username, [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"], [int $thumbsize = null], [int $imgmax = null])
  • string $username: The username on the account to get the albums for.
  • int $maxResults: The maximum number of results to return. Optional, the default is null.
  • int $startIndex: The first element number with the search results to return. Useful for pagination. Optional, the default is null.
  • string $visibility: Restrict the search to albums with the access rights specified here. Options are "public", "private", and "all". Authorization is required for "private" and "all" options. Optional, default is "public".
  • int $thumbsize: Comma-delimited list of thumbnail sizes to fetch. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800. URLs for the corresponding thumbnails are stored in the $thumbUrlMap of the Picasa_Image class. Optional, default is null. The default value will let Picasa choose the thumbnail sizes, which are stored in the $smallThumb, $mediumThumb, and $largeThumb fields of the Picasa_Image class.
  • int $imgmax: Size of image to return in the $content field of the Picasa_Image field. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600. Only values of 800 and less are displayable within a <a> HTML tag, all other values can only be downloaded directly through the user's browser. Optional, default value is null. The default value will let Picasa determine the size to return, which will not be useable within a <a> tag.
getAuthHeader (line 1777)

Constructs the line that is necessary for passing authorization information within the HTTP header to Picasa.

The object must already be authenticated when this method is called. Will work with either AuthSub or Client Login authorizations. Note that the line has "\r\n" already appended at the end because it is required for HTTP headers.

  • return: The header.
  • access: public
string getAuthHeader ()
getAuthToken (line 239)

Getter method for the $auth private field.

  • return: The auth token supplied by executing a successful authentication request to Google. The same field is used regardless of the type of authorization requested.
  • access: public
string getAuthToken ()
getAuthType (line 250)

Fetches the type of authorization this instantiation is configured with.

  • return: Possible return values are Picasa::$AUTH_TYPE_AUTH_SUB, Picasa:$AUTH_TYPE_CLIENT_LOGIN, and null if this object is not authenticated.
  • access: public
int getAuthType ()
getCommentById (line 927)

Retrieves the comment with the given id.

  • return: The requested comment.
  • throws: Picasa_Exception If the request was somehow invalid. For instance, if the image or album or comment do not exist.
  • access: public
Picasa_Image getCommentById (string $username, string $albumid, string $imageid, string $commentid)
  • string $username: The username on the account that the comment is in.
  • string $albumid: The id number of the album that the comment is located in.
  • string $imageid: The id number of the image that the comment is in.
  • string $commentid: The id number of the requested comment.
getCommentsByUsername (line 969)

Gets all comments that meet the criteria specified in the parameters.

The client can request images specific to just a user or to a user and an album. To get comments specific to an image, use getImageById() and call Picasa_Image::getComments() on the returned object. Passing null for any of the parameters will leave it up to Picasa to define the default values.

  • return: An array of Picasa_Comment objects, one for each comment in the requested feed.
  • throws: Picasa_Exception If something was wrong with the requested feed. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown.
  • access: public
array getCommentsByUsername (string $username, [string $albumid = null], [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"])
  • string $username: The username on the account to get the comments out of. It is not possible to get comments without specifying the username, so this field is required.
  • string $albumid: The id number of the album that the desired comments are in. Optional, the default is null.
  • int $maxResults: The maximum number of results to return. Optional, the default is null.
  • int $startIndex: The first element number with the search results to return. Useful for pagination. Optional, the default is null.
  • string $visibility: Restrict the search to comments in images with the access rights specified here. Options are "public", "private", and "all". Authorization is required for "private" and "all" options. Optional, default is "public".
getContactsByUsername (line 1004)

Retrieves contacts of the user specified in the parameter.

A contact is a Picasa user who the specified user has declared as a "Favorite". Should return an empty array unless the current Picasa instantiation is authorized.

  • return: An array of Picasa_Author objects, one for each of the user's contacts.
  • throws: Picasa_Exception If something was wrong with the requested feed. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown.
  • access: public
array getContactsByUsername (string $username)
  • string $username: The username on the account to get the contacts from.
getContext (line 273)

Turns a context array into a resource, which can then be used in PHP methods such as http://www.php.net/file_get_contents and http://www.php.net/fopen.

resource getContext ()
getContextArray (line 262)

Fetches the context array for this object.

The context array is defined at all times, whether or not the object is authenticated. However, when it is authenticated, it becomes possible to include the authorization token in the array.

  • access: public
array getContextArray ()
getImageById (line 812)

Retrieves the image with the given id.

  • return: The requested image.
  • todo: Refactor to use buildQueryParams()
  • throws: Picasa_Exception If the request was somehow invalid. For instance, if the image or album do not exist.
  • access: public
Picasa_Image getImageById (string $username, string $albumid, string $imageid, [int $thumbsize = null], [int $imgmax = null])
  • string $username: The username on the account that the image is in.
  • string $albumid: The id number of the album that the image is located in.
  • string $imageid: The id number of the desired image.
  • int $thumbsize: Comma-delimited list of thumbnail sizes to fetch. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800. URLs for the corresponding thumbnails are stored in the $thumbUrlMap of the Picasa_Image class. Optional, default is null. The default value will let Picasa choose the thumbnail sizes, which are stored in the $smallThumb, $mediumThumb, and $largeThumb fields of the Picasa_Image class.
  • int $imgmax: Size of image to return in the $content field of the Picasa_Image field. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600. Only values of 800 and less are displayable within a <a> HTML tag, all other values can only be downloaded directly through the user's browser. Optional, default value is null. The default value will let Picasa determine the size to return, which will not be useable within a <a> tag.
getImageByIdAsEntry (line 854)

Retrieves the image with the given id as an entry as opposed to a feed.

Picasa's data api makes a distinction between the two. The two different types will sometimes contain different fields. This method should only be used if you are sure that the field you need is not accessible through a feed, only through an entry. It is declared protected so that client code cannot call it directly, only extensions of the Picasa class.

  • return: The requested image.
  • throws: Picasa_Exception If the request was somehow invalid. For instance, if the image or album do not exist.
  • access: protected
Picasa_Image getImageByIdAsEntry (string $username, string $albumid, string $imageid)
  • string $username: The username on the account that the image is in.
  • string $albumid: The id number of the album that the image is located in.
  • string $imageid: The id number of the desired image.
getImages (line 677)

Retrieves all images meeting the supplied parameters.

Passing null for any of the parameters will leave it up to Picasa to define the default values.

  • return: An object holding meta information about the requested feed, as well as an array of Picasa_Image objects with each object that meets the supplied parameters.
  • link: http://code.google.com/apis/picasaweb/reference.html#Parameters
  • throws: Picasa_Exception If the request was somehow invalid. This could mean that the requested object does not have permission to retrieve the feed or the parameters supplied are not allowed by Picasa, or a number of other possible errors. A subclass of Picasa_Exception will be thrown, which will indicate specifically what the problem was with the request.
  • access: public
Picasa_ImageCollection getImages ([string $username = null], [int $maxResults = null], [int $startIndex = null], [string $keywords = null], [string $tags = null], [string $visibility = null], [int $thumbsize = null], [int $imgmax = null], [string $sortDescending = true], [string $boundingBox = null], [string $location = null])
  • string $username: The username on the account to get the images for. Optional, default is null.
  • int $maxResults: The maximum number of results to return. Optional, the default is null.
  • int $startIndex: The first element number with the search results to return. Useful for pagination. Optional, the default is null.
  • string $keywords: Space-delimited list of keywords to search for. Title and description are included in the search. Optional, default is an empty string.
  • string $tags: Space-delimited list of tags to search for. Only images with all tags in the list are included in the search results. Optional, default is empty string.
  • string $visibility: Restrict the search to images with the access rights specified here. Options are "public", "private", and "all". Authorization is required for "private" and "all" options. Optional, default is "public".
  • int $thumbsize: Comma-delimited list of thumbnail sizes to fetch. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800. URLs for the corresponding thumbnails are stored in the $thumbUrlMap of the Picasa_Image class. Optional, default is null. The default value will let Picasa choose the thumbnail sizes, which are stored in the $smallThumb, $mediumThumb, and $largeThumb fields of the Picasa_Image class.
  • int $imgmax: Size of image to return in the $content field of the Picasa_Image field. Options are 32, 48, 64, 72, 144, 160, 200, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600. Only values of 800 and less are displayable within a <a> HTML tag, all other values can only be downloaded directly through the user's browser. Optional, default value is null. The default value will let Picasa determine the size to return, which will not be useable within a <a> tag.
  • string $sortDescending: Whether or not to sort the items returned by date added descending.
  • string $boundingBox: Searches for images tagged as having been taken within a set of four coordinates. The coordinates should be in the order west, south, east, north
  • string $location: Searches for photos tagged as having been taken at a named location. For instance "London".
getTagsByUsername (line 893)

Retrieves tags that meet the supplied parameters.

Notice that this method will not retrieve tags specific to one image. To get tags by image, get an entire image object (using, for instance, getImageById()), and then call Picasa_Image::getTags() on that image. Passing null for any of the parameters will leave it up to Picasa to define the default values.

  • return: An array of Picasa_Tag objects, one for each tag in the requested feed.
  • throws: Picasa_Exception If the request was somehow invalid. This could mean that the requested object does not have permission to retrieve the feed or the parameters supplied are not allowed by Picasa, or a number of other possible errors. A subclass of Picasa_Exception will be thrown, which will indicate specifically what the problem was with the request.
  • access: public
array getTagsByUsername (string $username, [string $albumid = null], [int $maxResults = null], [int $startIndex = null], [string $visibility = "public"])
  • string $username: The username on the account to get the tags out of.
  • string $albumid: The id number of the album that the requested tags are in. Optional, the default is null.
  • int $maxResults: The maximum number of results to return. Optional, the default is null.
  • int $startIndex: The first element number with the search results to return. Useful for pagination. Optional, the default is null.
  • string $visibility: Restrict the search to tags in images with the access rights specified here. Options are "public", "private", and "all". Authorization is required for "private" and "all" options. Optional, default is "public".
isAuthenticated (line 288)

Determines whether the instantiated Picasa object has been authenticated.

In the case of a AuthSub authentication, the validity of the authentication is actually tested. In the case of ClientLogin authentication, it just checks for the existence of the auth token; there is no way in Picasa's API to test the validity of a ClientLogin authentication. If the instantiation has not been authenticated, this method will look for an auth token in the user's cookie and attempt to authenticate the object automatically, in which case true will be returned.

  • return: true if this instantiation is authenticated, false otherwise.
  • access: public
boolean isAuthenticated ()
isAuthorizationValid (line 458)

Checks if an AuthSub authorization is valid by requesting the information from Picasa.

This method can only be used on AuthSub authorizations; Picasa does not currently support this feature for Client Login authentications.

  • return: true if the authorization is valid, false if not.
  • throws: Picasa_Exception If the authorization is of type Client Login.
  • access: public
boolean isAuthorizationValid ()
postAlbum (line 1040)

Post a new album to Picasa Web Albums.

  • return: The album that was posted to Picasa.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown.
  • access: public
Picasa_Album postAlbum (string $username, string $title, [string $summary = ""], [string $rights = "public"], [string $commentingEnabled = "true"], [string $location = ""], [string $timestamp = null], [string $icon = null], [string $gmlPosition = null])
  • string $username: The username on the account to post the album to.
  • string $title: The title to assign to this album.
  • string $summary: A summary of the contents of the album. Optional, the default is an empty string.
  • string $rights: The access rights to assign to the album. Options are "public" and "private". Optional, the default is "public".
  • 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".
  • string $location: The location that the images in the album were taken. Optional, the default is an empty string.
  • 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. If null is passed here, the timestamp will be set to the current time.
  • string $icon: The image that appears as the album cover. Optional, the default is null.
  • 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.
postComment (line 1187)

Posts a comment to a photo on Picasa.

  • return: The comment that was posted.
  • throws: Picasa_Exception If there was a problem sending the comment. For instance, if the object is not authenticated or the image does not exist.
  • access: public
Picasa_Comment postComment (string $username, string $albumid, string $imageid, string $comment)
  • string $username: The username of the account that the image to comment on is in.
  • string $albumid: The album id of the album that the image to comment on is in.
  • string $imageid: The image id of the image that the comment is for.
  • string $comment: The text of the comment.
postImage (line 1094)

Posts an image to a Picasa Web Album.

Picasa_Image postImage (string $username, string $albumid, string $locationOnDisk, string $type, string $title, [string $summary = ""], [string $keywords = ""], [string $commentingEnabled = "true"], [string $timestamp = null], [string $gmlPosition = null])
  • string $username: The username on the account to post the image to.
  • string $albumid: The id number of the album to post the image to.
  • string $locationOnDisk: The path to the image on the local file system or network. Although this parameter has "OnDisk" in the name, you can specify a URL.
  • string $type: The type of image that is being uploaded. Picasa currently accepts "image/bmp", "image/gif", "image/jpeg", and "image/png".
  • string $title: The title that the image will be given.
  • string $summary: A summary of what is in the image. Optional, the default is an empty string.
  • string $keywords: A comma-delimited list of keywords associated with the image. Optional, the default is empty string.
  • string $commentingEnabled: Set to true if other users should be able to comment on the image and false if they shouldn't. Optional, the default is true.
  • string $timestamp: The number of miliseconds after the Unix epoch (January 1st, 1970) that the image was taken (roughly). Optional, the default is null, which will set $timestamp to the current time.
  • 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.
postTag (line 1152)

Add a tag to an existing Picasa image. A tag is a single word that describes all or part of the photo.

  • return: The image that the tag was posted to.
  • throws: Picasa_Exception If there was a problem sending the comment. For instance, if the object is not authenticated or the image does not exist.
  • access: public
Picasa_Image postTag (string $username, string $albumid, string $imageid, string $tag)
  • string $username: The username of the account that the image to tag is in.
  • string $albumid: The album id of the album that the image to tag is in.
  • string $imageid: The image id of the image that the tag is for.
  • string $tag: The tag to post.
saveAuthToCookie (line 539)

Saves the authentication token that was returned from Google to the user's browser in a cookie.

This way it can be accessed later and if it's still valid, the user does not need to be required to log in again. Since this deals with cookies, no output can go to the browser before this method is called or it will fail.

boolean saveAuthToCookie ([int $expires = 2592000])
  • int $expires: The number of seconds after the current time that the cookie should remain in the user's browser for. Optional, default is2592000 (30 days).
setAuthorizationInfo (line 226)

Sets the private fields in the object with authorization information that is passed in.

The fields are accessed when requests that require authorization are executed.

  • access: public
void setAuthorizationInfo (string $authToken, string $authType)
  • string $authToken: An authorization token returned by Picasa when a successful authentication request is executed.
  • string $authType: A string indicating which type of authorization was requested. Options are "ClientLogin" and "AuthSub". ClientLogin allows authorization directly with a username and password sent by the server, whereas AuthSub requires that the user be redirected to a login page hosted by Google.
updateAlbum (line 1245)

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.

  • return: The album that was updated.
  • throws: Picasa_Exception If something was wrong with the post to Picasa. A specific subclass of Picasa_Exception will be thrown based on what kind of problem was encountered, unless the type of error was unknown, in which case Picasa_Exception itself will be thrown.
  • access: public
Picasa_Album updateAlbum (string $username, string $albumid, [string $title = null], [string $summary = null], [string $icon = null], [string $rights = null], [string $commentingEnabled = null], [string $location = null], [string $timestamp = null], [string $gmlPosition = null])
  • string $username: The username on the account that the album is in.
  • string $albumid: The id number of the album to update.
  • string $title: The title to assign to this album. Optional, the default is null.
  • string $summary: A summary of the contents of the album. Optional, the default is an empty string. Optional, the default is null.
  • string $icon: The image that appears as the album cover. Optional, the default is null.
  • 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.
  • 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.
  • string $location: The location that the images in the album were taken. Optional, the default is an empty string.
  • 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.
  • 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.
updateImage (line 1323)

Updates an image in a Picasa Web Album. This method can be used for updating just the meta data or the meta data and image itself.

Passing null to any of the meta data parameters will cause that value in the album to not update. To just update the meta data and not the image itself, pass null to $newImageLocation and $type, and make sure at least one of the meta data parameters is not null. To update just the image contents and not the meta data, make sure all meta data parameters are null and the image location is not.

Picasa_Image updateImage (string $username, string $albumid, string $imageid, [string $title = null], [string $summary = null], [string $keywords = null], [string $commentingEnabled = null], [string $timestamp = null], [string $gmlPosition = null], [string $newImageLocation = null], [string $type = null])
  • string $username: The username on the account that the image is in.
  • string $albumid: The id number of the album to that the image is in.
  • string $imageid: The id number of the image to update.
  • string $title: The title that the image will be given. Optional, the default is null.
  • string $summary: A summary of what is in the image. Optional, the default is null.
  • string $keywords: A comma-delimited list of keywords associated with the image. Optional, the default is null.
  • string $commentingEnabled: Set to true if other users should be able to comment on the image and false if they shouldn't. Optional, the default is null.
  • string $timestamp: The number of miliseconds after the Unix epoch (January 1st, 1970) that the image was taken (roughly).
  • 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.
  • string $newImageLocation: The path to the image on the local file system or network. You can specify a URL. This parameter can be null, in which case only the meta data will be updated.
  • string $type: The type of image that is being uploaded. Picasa currently accepts "image/bmp", "image/gif", "image/jpeg", and "image/png". This parameter can be null if the $locationOnDisk parameter is also null, in which case on the meta data of the image will be updated and the image itself will stay the same.
__toString (line 2090)

Constructs a textual representation of everything in the current instantiation of the object.

  • access: public
string __toString ()

Documentation generated on Tue, 02 Jun 2009 14:51:53 -0700 by phpDocumentor 1.4.1