Procedural File: image_album_statistics.php
Source Location: /zp-extensions/image_album_statistics.php
Page Details
image_album_statistics -- support functions for "statistics" about images and albums.
Supports such statistics as "most popular", "latest", "top rated", etc. C A U T I O N: With 1.0.4.7 the usage to get an specific album changes. You now have to pass the foldername of an album instead the album title.
| Author: | Malte Müller (acrylian), Stephen Billard (sbillard) |
Functions
checkIfNew [line 589]
A little helper function that checks if an image or album is to be considered 'new' within the time range set in relation to getImageDate()/getAlbumDate() Returns true or false.
Parameters:
|
string |
$mode: |
What to check "image" or "album". |
|
integer |
$timerange: |
The time range the item should be considered new. Default is 604800 (unix time seconds = ca. 7 days) |
bool checkIfNew(
[string $mode = "image"], [integer $timerange = 604800]
)
|
|
getAlbumStatistic [line 29]
Retuns a list of album statistic accordingly to $option
Parameters:
|
int |
$number: |
the number of albums to get |
|
string |
$option: |
"popular" for the most popular albums, "latest" for the latest uploaded, "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated |
|
string |
$albumfolder: |
The name of an album to get only the statistc for its subalbums |
string getAlbumStatistic(
[int $number = 5], string $option, [string $albumfolder = '']
)
|
|
getImageStatistic [line 314]
Returns a list of image statistic according to $option
Parameters:
|
string |
$number: |
the number of images to get |
|
string |
$option: |
"popular" for the most popular images, "latest" for the latest uploaded, "latest-date" for the latest uploaded, but fetched by date, "latest-mtime" for the latest uploaded, but fetched by mtime, "mostrated" for the most voted, "toprated" for the best voted |
|
string |
$albumfolder: |
foldername of an specific album |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
string getImageStatistic(
string $number, string $option, [string $albumfolder = ''], [bool $collection = false]
)
|
|
getNumAllSubalbums [line 613]
Gets the number of all subalbums of all subalbum levels of either the current album or $albumobj
Parameters:
|
object |
$albumobj: |
Optional album object to check |
|
string |
$pre: |
Optional text you want to print before the number |
bool getNumAllSubalbums(
object $albumobj, [string $pre = '']
)
|
|
printAlbumStatistic [line 106]
Prints album statistic according to $option as an unordered HTML list A css id is attached by default named '$option_album'
Parameters:
|
string |
$number: |
the number of albums to get |
|
string |
$option: |
"popular" for the most popular albums, "latest" for the latest uploaded, "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
|
$albumfolder: |
|
|
|
$firstimglink: |
|
void printAlbumStatistic(
string $number, string $option, [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [ $firstimglink = false]
)
|
|
printAlbumStatisticItem [line 138]
A helper function that only prints a item of the loop within printAlbumStatistic() Not for standalone use.
Parameters:
|
array |
$album: |
the array that getAlbumsStatistic() submitted |
|
string |
$option: |
"popular" for the most popular albums, "latest" for the latest uploaded, "mostrated" for the most voted, "toprated" for the best voted "latestupdated" for the latest updated |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
void printAlbumStatisticItem(
array $album, string $option, [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $firstimglink = false]
)
|
|
printImageStatistic [line 413]
Prints image statistic according to $option as an unordered HTML list A css id is attached by default named accordingly'$option'
Parameters:
|
string |
$number: |
the number of albums to get |
|
string |
$option: |
"popular" for the most popular images, "latest" for the latest uploaded, "latest-date" for the latest uploaded, but fetched by date, "latest-mtime" for the latest uploaded, but fetched by mtime, "mostrated" for the most voted, "toprated" for the best voted |
|
string |
$albumfolder: |
foldername of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
string printImageStatistic(
string $number, string $option, [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printLatestAlbums [line 236]
Prints the latest albums
Parameters:
|
string |
$number: |
the number of albums to get |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
|
|
$albumfolder: |
|
void printLatestAlbums(
[string $number = 5], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [bool $firstimglink = false]
)
|
|
printLatestImages [line 533]
Prints the latest images by ID (the order zenphoto recognized the images on the filesystem)
Parameters:
|
string |
$number: |
the number of images to get |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printLatestImages(
[string $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printLatestImagesByDate [line 554]
Prints the latest images by date order (date taken order)
Parameters:
|
string |
$number: |
the number of images to get |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printLatestImagesByDate(
[string $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printLatestImagesByMtime [line 575]
Prints the latest images by mtime order (date uploaded order)
Parameters:
|
string |
$number: |
the number of images to get |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printLatestImagesByMtime(
[string $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printLatestUpdatedAlbums [line 296]
Prints the top voted albums
Parameters:
|
string |
$number: |
the number of albums to get |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
|
|
$albumfolder: |
|
void printLatestUpdatedAlbums(
[string $number = 5], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [bool $firstimglink = false]
)
|
|
printMostRatedAlbums [line 256]
Prints the most rated albums
Parameters:
|
string |
$number: |
the number of albums to get |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
|
|
$albumfolder: |
|
void printMostRatedAlbums(
[string $number = 5], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [bool $firstimglink = false]
)
|
|
printMostRatedImages [line 512]
Prints the n most rated images
Parameters:
|
int |
$number: |
The number if images desired |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printMostRatedImages(
[int $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printPopularAlbums [line 216]
Prints the most popular albums
Parameters:
|
string |
$number: |
the number of albums to get |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
|
|
$albumfolder: |
|
void printPopularAlbums(
[string $number = 5], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = 'hitcounter'], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [bool $firstimglink = false]
)
|
|
printPopularImages [line 469]
Prints the most popular images
Parameters:
|
string |
$number: |
the number of images to get |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printPopularImages(
[string $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
printTopRatedAlbums [line 276]
Prints the top voted albums
Parameters:
|
string |
$number: |
the number of albums to get |
|
bool |
$showtitle: |
if the album title should be shown |
|
bool |
$showdate: |
if the album date should be shown |
|
bool |
$showdesc: |
if the album description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$firstimglink: |
'false' (default) if the album thumb link should lead to the album page, 'true' if to the first image of theh album if the album itself has images |
|
|
$albumfolder: |
|
void printTopRatedAlbums(
[string $number = 5], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [ $albumfolder = ''], [bool $firstimglink = false]
)
|
|
printTopRatedImages [line 490]
Prints the n top rated images
Parameters:
|
int |
$number: |
The number if images desired |
|
string |
$albumfolder: |
folder of an specific album |
|
bool |
$showtitle: |
if the image title should be shown |
|
bool |
$showdate: |
if the image date should be shown |
|
bool |
$showdesc: |
if the image description should be shown |
|
integer |
$desclength: |
the length of the description to be shown |
|
string |
$showstatistic: |
"hitcounter" for showing the hitcounter (views), "rating" for rating, "rating+hitcounter" for both. |
|
integer |
$width: |
the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px) |
|
integer |
$height: |
the height/cropheight of the thumb if crop=true else not used. (Default 85px) |
|
bool |
$crop: |
'true' (default) if the thumb should be cropped, 'false' if not |
|
bool |
$collection: |
only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums |
void printTopRatedImages(
[int $number = 5], [string $albumfolder = ""], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false]
)
|
|
|
|