









PHP 5 or later required.

This work is licensed under a Creative Commons Attribution2.5 License.
Version 1.3.2
<?php
require_once 'sspclass.php' ;
$myflickr = new makeSSPxml('images.xml',3600) ;
$myflickr->debug(true) ;
$myflickr->number(15) ;
$myflickr->add_interesting() ;
$myflickr->add_favorites('34021154@N00') ;
$myflickr->add_pool('16978849@N00') ;
$myflickr->set_thumb($myflickr->indiv_thumb('22942108@N00')) ;
$myflickr->add_photoset('1426133') ;
$myflickr->finish() ;
$myflickr->emit_headers() ;
?>
View result of sample code in new window. Note that the page may be slow to load due to the time it takes Flickr to respond to some of the calls.
Download the class and instructions here
$path: path to output xml file (relative to web page)
$lifetime: length of time to cache results (in seconds)
Example: $myflickr = new makeSSPxml('images.xml',3600) ;
Limits duration the web page will be cached to equal the remaining lifetime of the xml file. This needs to be called either 1) prior to the opening <html> tag, or 2) anywhere in the file if the file is buffered (by inserting <?php ob_start("ob_gzhandler"); ?> prior to the head tag).
Example: $myflickr->emit_headers() ;
Writes out the xml file. Call after it is completely assembled.
Example: $myflickr->finish() ;
Adds an album consisting of the specified user’s favorite pictures.
$user: The flickr NSID (e.g., 34021154@N00) for the desired user. This can be found by going to the user’s main page and looking at the URL. The URL for the above ID would be http://www.flickr.com/photos/34021154@N00/. The last portion, with the ‘@’ symbol, is the NSID. NSIDs can also be found by looking them up at http://idgettr.com/.
$title (optional): Title for this album. If not specified or if '', will be the username associated with the specified NSID.
$description (optional): Description for this album. If not specified or if '', will be the user’s real name and location.
Example: $myflickr->add_favorites('34021154@N00') ;
Adds an album with pictures of high “interestingness” score for today (unless date specified as described below).
$title (optional): Title for this album. If not specified or if '', will be “Flickr interestingness photos.”
$description (optional): Description for this album. If not specified or if '', will be “Most interesting photos from today” (or “Most interesting photos from [date]” if date is specified.)
Example: $myflickr->add_interesting() ;
Optionally, you can add search for a specific date by calling search_parameter('date',$value) ; before calling add_interesting. The parameter will be cleared after add_interesting is called. The following parameter is supported:
Adds albums to the final file. The albums have to have been generated previously. This is useful to mix your own albums in with Flickr albums, or if you want to form an SSP xml file containing a collection of albums from other SSP xml files.
This method will extract and use the albums from a regular SSP xml file. This function will also work on a file that just has the <album> and <img> tags in case you are too lazy to make a fully-formed SSP file.
$path: path to xml file (relative to web page)
Example: $myflickr->add_xml('../slideshow/extras.xml') ;
Adds an album of pool pictures from the specified group.
$pool: The NSID for the desired group’s pool. This can be seen by going to the group’s home page (e.g., http://www.flickr.com/groups/blackandwhite/). Scroll to near the bottom of the page where you’ll find the phrase “Discussion feeds for> [group name] Available as RSS 2.0 and Atom.” Click on the RSS 2.0 link. The resulting URL will have the NSID in it (e.g., http://www.flickr.com/groups_feed.gne?id=16978849@N00&format=rss_200). NSIDs can also be found by looking them up at http://idgettr.com/.
$title (optional): Title for this album. If not specified or if '', will be the name of the group.
$description (optional): Description for this album. If not specified or if '', will be the official group description.
Example: $myflickr->add_pool('tokyo') ;
Optionally, you can add search parameters by calling search_parameter($type,$value) ; before calling add_pool. The search parameters will be cleared after add_pool is called. The following search parameters are supported:
Adds an album with pictures that include the specified tags. This method can take many of the same parameters as add_search (see table below and add_search description).
$tags: comma delimited string of tags to search for.
$title (optional): Title for this album. If not specified or if '', will be blank.
$description (optional): Description for this album. If not specified or if '', will be blank.
$tagmode (optional): Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'all' if not specified.
Example: $myflickr->add_tags('jump,blue','Jump and blue','Photos with both jump and blue tags.') ;
Adds an album of the pictures in the specified photoset.
$setno: The photoset ID. This can be found by selecting the desired photoset in Flickr. The URL will be like this: http://www.flickr.com/photos/gallo1/sets/1745603/, where the long number is the photoset ID. The title and description will be the title and description assigned by the owner of the set.
Example: $myflickr->add_photoset('1745603') ;
Flexible method, allows you to set many different search parameters through calls to search_parameter($type,$value) ;. The search parameters are cleared after each call to add_search. Album title and description are blank if not specified. Search parameters:
Example:
$myflickr->search_parameter('min_taken_date','2004-12-31 12:31:01') ;
$myflickr->search_parameter('tags','jump,blue') ;
$myflickr->add_search('Recent jump & blue','Pictures taken after Dec 31, 2004, 12:31 pm, with jump or blue as tags') ;
thumbs(true or false): Whether thumbnail location is included in xml file. Affects subsequent method calls only. Default is true.
links(true or false): Whether link to full size picture is included in xml file. Affects subsequent method calls only. Default is true.
captions(true or false): Whether picture’s caption is included in xml file. Affects subsequent method calls only. Default is true.
number(0 to 500): Sets maximum number of pictures to retrieve from each method call (excluding add_xml.) Affects subsequent method calls only. Default is 100.
debug(true or false): If set to true, will echo to the browser descriptions of any errors encountered. Affects subsequent method calls only. Default is false. Should be set to true when debugging your script.
stop_if_error(true or false): If set true, will not overwrite prior xml file if error is encountered and will not try any further calls to Flickr. Default is true.
album_thumbs(true or false): Whether album thumbnail location is included in xml file. Affects subsequent method calls only. Default is true.
Album thumbnails can be set by calling set_thumb(url) prior to the add_ call. Each add_ call will clear the setting, so a thumbnail needs to be set prior to each add_ call if you desire to specify one. Two methods, add_pool and add_photoset are able to obtain an appropriate thumbnail from Flickr if one is not set. To assist in setting thumbnails for the other methods, two methods are supplied to obtain the url for a group thumb or a personal thumb: group_thumb($NSID) and indiv_thumb($NSID). These can be used as follows:
$myflickr->set_thumb($myflickr->indiv_thumb('22942108@N00')) ;
$myflickr->add_photoset('1426133') ;
| add_favorites | add_interesting | add_photoset | add_pool | add_search | add_tags | add_xml | |
| user_id | Y | Y | Y | ||||
| tags | Y | Y | |||||
| tag_mode | Y | ||||||
| text | Y | Y | |||||
| min_upload_date | Y | Y | |||||
| max_upload_date | Y | Y | |||||
| min_taken_date | Y | Y | |||||
| max_taken_date | Y | Y | |||||
| license | Y | Y | |||||
| sort | Y | Y | |||||
| date | Y |