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.
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.
Generates the XML necessary for creating a Picasa Web Album.
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.
Generates the XML necessary for creating a Picasa image.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
- to enable session tokens, 0 to disable.
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.
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.
- to enable session tokens, 0 to disable.
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.
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.
boolean
authorizeFromCookie
()
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).
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.
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.
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.
void
clearAuthentication
()
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.
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.
string
convertFromSingleUseToSessionToken
()
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.
{@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.
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.
{@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.
If the current instantiation is authorized using the "AuthSub" method, this actively invalidates the token.
boolean
deauthorize
()
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!).
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.
Deletes a comment applied to a specific image in Picasa Web Albums.
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
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!).
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.
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.
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.
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.
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.
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.
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.
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.
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.
string
getAuthHeader
()
Getter method for the $auth private field.
string
getAuthToken
()
Fetches the type of authorization this instantiation is configured with.
int
getAuthType
()
Retrieves the comment with the given id.
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.
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.
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".
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.
array
getContactsByUsername
(string $username)
-
string
$username: The username on the account to get the contacts from.
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.
array
getContextArray
()
Retrieves the image with the given id.
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.
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.
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.
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.
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".
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.
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".
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.
boolean
isAuthenticated
()
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.
boolean
isAuthorizationValid
()
Post a new album to Picasa Web Albums.
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.
Posts a comment to a photo on Picasa.
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.
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.
Add a tag to an existing Picasa image. A tag is a single word that describes all or part of the photo.
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.
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).
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.
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.
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.
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.
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.
Constructs a textual representation of everything in the current instantiation of the object.
string
__toString
()