Class PHPFSPOT

Description

PHPFSPOT main class

this class contains the most functions which will to the major work for phpfspot.

Located in /phpfspot.class.php (line 36)


	
			
Variable Summary
Method Summary
 PHPFSPOT __construct ()
 void __destruct ()
 string addTag ( $tag)
 boolean checkifImageSupported (string $mime)
 boolean create_thumbnail (string $orig_image, string $thumb_image, integer $width)
 string delTag (string $tag)
 void gen_thumb ([integer $idx = 0], [integer $force = 0], [boolean $overwrite = false])
 void getExport (string $mode)
 string|null getFspotDBVersion ()
 string|null getMD5 (integer $idx, [ $version_idx = 0])
 string|null getPhotoName (integer $idx, [integer $limit = 0])
 void getRSSFeed ()
 string getSelectedTags ([ $type = 'link'])
 void get_calendar_matrix ( $userdate, integer $year, integer $month, integer $day)
 integer get_db_version ()
 int get_latest_version ( $photo_idx)
 array get_meta_informations (string $file)
 string get_mime_info (string $file)
 integer get_num_photos (integer $tag_id)
 object|null get_photo_details (integer $idx, [ $version_idx = NULL])
 integer get_photo_rating (integer $idx)
 array get_photo_versions (int $idx)
 string get_photo_version_name (int $photo_idx, int $version_idx)
 array get_random_photo ()
 array get_random_tag_photo ( $tagidx)
 string get_rate_search ()
 string get_tag_name (integer $idx)
 string get_thumb_path (integer $width,  $photo_idx,  $version_idx, integer $photo)
 string get_xml_tag_list ()
 boolean isValidDate (string $date_str)
 bool is_valid_version (int $photo_idx, int $version_idx)
 void is_valid_width ( $image_width)
 string parse_uri (string $uri, string $mode)
 void resetDateSearch ()
 void resetNameSearch ()
 void resetPhotoView ()
 void resetRateSearch ()
 void resetSlideShow ()
 void resetTags ()
 void resetTagSearch ()
 string setTagCondition (string $mode)
 void show ()
 void showCredits ()
 void showPhoto (integer $photo)
 string showPhotoIndex ()
 void showTextImage (string $txt, [string $color = 000000], [integer $space = 4], [integer $font = 4], [integer $w = 300])
 string smarty_photo_version_select_list (array $params,  &$smarty, smarty $smarty)
 string smarty_sort_select_list (array $params,  &$smarty, smarty $smarty)
 string startSearch ()
 string translate_path (string $path)
 string updateSortOrder ( $order, string $sort_order)
 string update_photo_version ( $photo_idx, string $photo_version)
 string whatToDo ()
 void _error (string $text)
Variables
array $avail_tags (line 83)

list of available, not-selected, tags

  • access: public
PHPFSPOT_CFG $cfg (line 44)

phpfspot configuration

  • see: PHPFSPOT_CFG()
  • access: public
PHPFSPOT_DB $cfg_db (line 60)

SQLite database handle to phpfspot database

  • see: PHPFSPOT_DB()
  • access: public
PHPFSPOT_DB $db (line 52)

SQLite database handle to f-spot database

  • see: PHPFSPOT_DB()
  • access: public
array $tags (line 76)

full tag - list

  • access: public
PHPFSPOT_TMPL $tmpl (line 69)

Smarty template engine

Methods
Constructor __construct (line 106)

class constructor ($cfg, $db, $cfg_db, $tmpl, $db_ver)

this function will be called on class construct and will check requirements, loads configuration, open databases and start the user session

  • access: public
PHPFSPOT __construct ()
Destructor __destruct (line 256)
  • access: public
void __destruct ()
addTag (line 1031)

add tag to users session variable

this function will add the specified to users current tag selection. if a date search has been made before it will be now cleared

  • access: public
string addTag ( $tag)
  • $tag
checkifImageSupported (line 2608)

check if specified MIME type is supported

  • access: public
boolean checkifImageSupported (string $mime)
  • string $mime
check_phpfspot_db (line 1944)

create phpfspot own sqlite database

this function creates phpfspots own sqlite database if it does not exist yet. this own is used to store some necessary informations (md5 sum's, ...).

  • access: public
void check_phpfspot_db ()
cleanup_phpfspot_db (line 3575)

cleanup phpfspot own database

When photos are getting delete from F-Spot, there will remain remain some residues in phpfspot own database. This function will try to wipe them out.

  • access: public
void cleanup_phpfspot_db ()
create_thumbnail (line 1697)

create thumbnails for the requested width

this function creates image thumbnails of $orig_image stored as $thumb_image. It will check if the image is in a supported format, if necessary rotate the image (based on EXIF orientation meta headers) and re-sizing.

  • access: public
boolean create_thumbnail (string $orig_image, string $thumb_image, integer $width)
  • string $orig_image
  • string $thumb_image
  • integer $width
delTag (line 1060)

remove tag to users session variable

this function removes the specified tag from users current tag selection

  • access: public
string delTag (string $tag)
  • string $tag
gen_thumb (line 2080)

generates thumbnails

This function generates JPEG thumbnails from provided F-Spot photo indize and its alternative versions.

  1. Check if all thumbnail generations (width) are already in place and readable
  2. Check if the md5sum of the original file has changed
  3. Generate the thumbnails if needed

  • access: public
void gen_thumb ([integer $idx = 0], [integer $force = 0], [boolean $overwrite = false])
  • integer $idx
  • integer $force
  • boolean $overwrite
getAvailableTags (line 884)

all available tags and tag cloud

this function outputs all available tags (time ordered) and in addition output them as tag cloud (tags which have many photos will appears more then others)

  • access: public
void getAvailableTags ()
getExport (line 2780)

output export page

  • access: public
void getExport (string $mode)
  • string $mode
getFspotDBVersion (line 3439)

retrive F-Spot database version

this function will return the F-Spot database version number It is stored within the sqlite3 database in the table meta

  • access: public
string|null getFspotDBVersion ()
getMD5 (line 2191)

returns stored md5 sum for a specific photo

this function queries the phpfspot database for a stored MD5 checksum of the specified photo. It also takes care of the requested photo version - original or alternative photo.

  • access: public
string|null getMD5 (integer $idx, [ $version_idx = 0])
  • integer $idx
  • $version_idx
getNextSlideShowImage (line 3114)

return the next to be shown slide show image

this function returns the URL of the next image in the slideshow sequence.

  • access: public
string getNextSlideShowImage ()
getPhotoName (line 594)

returns aligned photo names

this function returns aligned (length) names for a specific photo. If the length of the name exceeds $limit the name will bei shrinked (...).

  • access: public
string|null getPhotoName (integer $idx, [integer $limit = 0])
  • integer $idx
  • integer $limit
getPhotoSelection (line 1217)

return all photo according selection

this function returns all photos based on the tag-selection, tag- or date-search. the tag-search also has to take care of AND and OR conjunctions

  • access: public
array getPhotoSelection ()
getPrevSlideShowImage (line 3138)

return the previous to be shown slide show image

this function returns the URL of the previous image in the slideshow sequence.

  • access: public
string getPrevSlideShowImage ()
getRSSFeed (line 2827)

output RSS feed

  • access: public
void getRSSFeed ()
getSelectedTags (line 983)

output all selected tags

this function output all tags which have been selected by the user. the selected tags are stored in the session-variable $_SESSION['selected_tags']

  • access: public
string getSelectedTags ([ $type = 'link'])
  • $type
get_calendar_matrix (line 2685)

output calendar matrix

  • access: public
void get_calendar_matrix ( $userdate, integer $year, integer $month, integer $day)
  • integer $year
  • integer $month
  • integer $day
  • $userdate
get_current_photo (line 2923)

return the current photo

  • access: public
void get_current_photo ()
get_current_version (line 2941)

current selected photo version

this function returns the current selected photo version from the session variables.

  • access: public
int get_current_version ()
get_db_version (line 3770)

get database version

this function queries the meta table and returns the current database version.

  • access: public
integer get_db_version ()
get_latest_version (line 2959)

returns latest available photo version

this function returns the latested available version for the requested photo.

  • access: public
int get_latest_version ( $photo_idx)
  • $photo_idx
get_meta_informations (line 1931)

return all exif meta data from the file

  • access: public
array get_meta_informations (string $file)
  • string $file
get_mime_info (line 3636)

return mime info

this function tries to find out the correct mime-type for the provided file.

  • access: public
string get_mime_info (string $file)
  • string $file
get_num_photos (line 3368)

returns the number of photos which are tagged with $tag_id

  • access: public
integer get_num_photos (integer $tag_id)
  • integer $tag_id
get_photo_details (line 480)

get all photo details from F-Spot database

this function queries the F-Spot database for all available details of the requested photo. It returns them as a object.

Furthermore it takes care of the photo version to be requested. If photo version is not yet, it queries information for the original photo.

  • access: public
object|null get_photo_details (integer $idx, [ $version_idx = NULL])
  • integer $idx
  • $version_idx
get_photo_rating (line 618)

get photo rating level

this function will return the integer-based rating level of a photo. This can only be done, if the F-Spot database is at a specific version. If rating value can not be found, zero will be returned indicating no rating value is available.

  • access: public
integer get_photo_rating (integer $idx)
  • integer $idx: idx
get_photo_versions (line 3798)

get photo versions

this function returns an array of all available alterntaive versions of the provided photo id. has alternative photo versions available

  • access: public
array get_photo_versions (int $idx)
  • int $idx
get_photo_version_name (line 3852)

get photo version name

this function returns the name of the version identified by the photo-id and version-id.

  • access: public
string get_photo_version_name (int $photo_idx, int $version_idx)
  • int $photo_idx
  • int $version_idx
get_random_photo (line 3173)

get random photo

this function will get all photos from the fspot database and randomly return ONE entry

saddly there is yet no sqlite3 function which returns the bulk result in array, so we have to fill up our own here.

  • access: public
array get_random_photo ()
get_random_tag_photo (line 3216)

get random photo tag photo

this function will get all photos tagged with the requested tag from the fspot database and randomly return ONE entry

saddly there is yet no sqlite3 function which returns the bulk result in array, so we have to fill up our own here.

  • access: public
array get_random_tag_photo ( $tagidx)
  • $tagidx
get_rate_search (line 636)

get rate-search bars

this function will return the rating-bars for the search field.

  • access: public
string get_rate_search ()
get_tag_name (line 3663)

return tag-name by tag-idx

this function returns the tag-name for the requested tag specified by tag-idx.

  • access: public
string get_tag_name (integer $idx)
  • integer $idx
get_thumb_path (line 3318)

returns the full path to a thumbnail

  • access: public
string get_thumb_path (integer $width,  $photo_idx,  $version_idx, integer $photo)
  • integer $width
  • integer $photo
  • $photo_idx
  • $version_idx
get_xml_tag_list (line 1092)

returns the value for the autocomplete tag-search

  • access: public
string get_xml_tag_list ()
isValidDate (line 3270)

validates provided date

this function validates if the provided date contains a valid date and will return true if it is.

  • access: public
boolean isValidDate (string $date_str)
  • string $date_str
is_valid_version (line 3827)

check for invalid version of photo

this function validates the provided photo-id and version-id

  • access: public
bool is_valid_version (int $photo_idx, int $version_idx)
  • int $photo_idx
  • int $version_idx
is_valid_width (line 3874)
  • access: public
void is_valid_width ( $image_width)
  • $image_width
parse_uri (line 3459)

parse the provided URI and will returned the requested chunk

  • access: public
string parse_uri (string $uri, string $mode)
  • string $uri
  • string $mode
resetDateSearch (line 1185)

reset date search

if any date search has taken place, reset it now.

  • access: public
void resetDateSearch ()
resetNameSearch (line 1173)

reset name search

if any name search has taken place, reset it now

  • access: public
void resetNameSearch ()
resetPhotoView (line 1146)

reset single photo

if a specific photo was requested (external link) unset the session variable now

  • access: public
void resetPhotoView ()
resetRateSearch (line 1199)

reset rate search

if any rate search has taken place, reset it now.

  • access: public
void resetRateSearch ()
resetSlideShow (line 3155)
  • access: public
void resetSlideShow ()
resetTags (line 1081)

reset tag selection

if there is any tag selection, it will be deleted now

  • access: public
void resetTags ()
resetTagSearch (line 1161)

reset tag search

if any tag search has taken place, reset it now

  • access: public
void resetTagSearch ()
setTagCondition (line 2241)

store current tag condition

this function stores the current tag condition (AND or OR) in the users session variables

  • access: public
string setTagCondition (string $mode)
  • string $mode
show (line 270)

show - generate html output

this function can be called after the constructor has prepared everyhing. it will load the index.tpl smarty template. if necessary it will registere pre-selects (photo index, photo, tag search, date search) into users session.

  • access: public
void show ()
showCredits (line 1676)

show credit template

  • access: public
void showCredits ()
showPhoto (line 723)

control HTML ouput for a single photo

this function provides all the necessary information for the single photo template.

  • access: public
void showPhoto (integer $photo)
  • integer $photo: photo
showPhotoIndex (line 1454)

control HTML ouput for photo index

this function provides all the necessary information for the photo index template.

  • access: public
string showPhotoIndex ()
showTextImage (line 2510)

create on-the-fly images with text within

  • access: public
void showTextImage (string $txt, [string $color = 000000], [integer $space = 4], [integer $font = 4], [integer $w = 300])
  • string $txt
  • string $color
  • integer $space
  • integer $font
  • integer $w
smarty_photo_version_select_list (line 3019)

photo version select list

this function returns a HTML select list (drop down) to select a alternative photo version of the original photo.

  • access: public
string smarty_photo_version_select_list (array $params,  &$smarty, smarty $smarty)
  • array $params
  • smarty $smarty
  • &$smarty
smarty_sort_select_list (line 3046)

returns a select-dropdown box to select photo index sort parameters

  • access: public
string smarty_sort_select_list (array $params,  &$smarty, smarty $smarty)
  • array $params
  • smarty $smarty
  • &$smarty
startSearch (line 2259)

invoke tag & date search

this function will return all matching tags and store them in the session variable selected_tags. furthermore it also handles the date search. getPhotoSelection() will then only return the matching photos.

  • access: public
string startSearch ()
translate_path (line 705)

translate f-spoth photo path

as the full-qualified path recorded in the f-spot database is usally not the same as on the webserver, this function will replace the path with that one specified in the cfg

  • access: public
string translate_path (string $path)
  • string $path
updateSortOrder (line 2333)

updates sort order in session variable

this function is invoked by RPC and will sort the requested sort order in the session variable.

  • access: public
string updateSortOrder ( $order, string $sort_order)
  • string $sort_order
  • $order
update_photo_version (line 2352)

update photo version in session variable

this function is invoked by RPC and will set the requested photo version in the session variable.

  • access: public
string update_photo_version ( $photo_idx, string $photo_version)
  • string $photo_version
  • $photo_idx
whatToDo (line 2980)

tells the client browser what to do

this function is getting called via AJAX by the client browsers. it will tell them what they have to do next. This is necessary for directly jumping into photo index or single photo view when the are requested with specific URLs

  • access: public
string whatToDo ()
_error (line 2628)

output error text

  • access: public
void _error (string $text)
  • string $text

Documentation generated on Sat, 30 May 2009 10:14:35 +0200 by phpDocumentor 1.4.2