cpmfetch V2.2
$options, $source, functions and tags
Option |
Effect on Static
images |
Effect on Slideshow |
alttag |
Defines ALT and TITLE text. These are i) the text if the image does not display; ii) what you see when hovering the mouse pointer over the image. Substitution supported. Example: 'alttag' => '{{pTitle}} by {{uUser_name}}', |
Same |
cellattributes |
Attributes for the <TD> tag Example: 'cellattributes' => array("colspan" => "2"), |
Same |
cellstyle |
Name of the CSS class for the <TD> tag Example: 'cellstyle' => 'kfcellstyle', |
Same |
cellstyleproperties |
CSS properties e.g. border-style:solid applied to the <TD> bordering image and title Example: 'cellstyleproperties' => 'vertical-align:top', |
Same |
imageattributes |
Attributes for the <IMG> tag Example: 'imageattributes' => array("referrerpolicy" => "origin"), |
Same |
imageheight |
Height of image in pixels Example: 'imageheight' => '250', |
Not applicable in slideshow although values can be set |
imagelink |
Value can be set to album, thumb, int, large, none and will provide different links accordingly . Combination: = large and windowtarget =_blank-js creates large separate js display window = large and windowtarget = blank displays large image in new browser window =album = displays gallery thumbnails =thumb = displays gallery thumbnails =int = displays gallery image display screen (default) not set = as int above =none == no link Example: 'imagelink' => 'none', |
Same |
imagesize |
Size of image used for the display. Can be: thumb = thumbnail image int = intermediate image if it exists ehr = for future use large = full size image Example: 'imagesize' => 'int', |
Same |
imagestyle |
Name of the CSS class for the <IMG> tag Example: 'imagestyle' => 'slidestyle', |
Same |
imagestyleproperties |
CSS properties applied to the <IMG> e.g. border-style:solid Example: 'imagestyleproperties' => 'height:250px !important', |
Same |
imagewidth |
Width of image in pixels Example: 'imagewidth' => '500', |
Not applicable in slideshow although values can be set |
linkattributes |
Attributes for the <a> tag Example: 'linkattributes' => array("rel" => "alternate"), |
Same |
linkstyle |
Name of CSS style added to the <a> tag Example: 'linkstyle' => 'kflinkstyle', |
Same |
linkstyleproperties |
CSS properties added to the <a> tag Example: 'linkstyleproperties' => 'color:green;', |
Not supported |
linktemplate |
Overrides the regular link with a custom link, potentially containing substitutions. Must be a full URL if going to another site. If not, will be relative to cpmfetch Example: 'linktemplate' => 'https://coppermine-gallery.net/', |
Same |
noimage |
Suppresses image display. Any key value Example: 'noimage' => '1', |
Not supported. |
rowattributes |
Previously set attributes for <TR> tag. There are none now so has been deprecated. Not supported. |
Not supported |
rowheaderattributes |
Sets attributes for <TH> tag. Example: 'rowheaderattributes' => array("rowspan" => "3"), |
Not supported |
rowstyle |
Sets name of CSS class to be used for <TR> tag Example: 'rowstyle' => 'kfrowstyle', |
Not supported |
rowstyleproperties |
Sets CSS properties for <TR> tag Example: 'rowstyleproperties' => 'border-style:solid', |
Not supported |
sortorder |
Used when sorting the results from cpm_viewMediaFromAlbum and cpm_viewMediaFromCategory. Values are: na – filename ascending nd - filename descending ta - title ascending td - title descending da – Capture Time ascending dd - Capture Time descending pa - position in album ascending pd - position in album descending Example: 'sortorder' => 'ta', |
Not supported |
subtitle |
Text to go in the subtitle field with optional substitution Example: 'subtitle' => 'Title: {{pTitle}}, Photographer: {{uUser_name}}', |
Same |
subtitlelink |
When set to any value the subtitle becomes a link: similar to image link Example: 'subtitlelink' => 'x', |
same |
subtitlestyle |
subtitle text CSS style name Example: 'subtitlestyle' => 'kfsubtitlestyle', |
same |
subtitlestyleproperties |
subtitle text CSS properties Example: 'subtitlestyleproperties' => 'color:green;', |
same |
tableattributes |
Attributes for the <TABLE> tag Example: 'tableattributes' => array("width" => "100%"), |
same |
tableheadstyle |
Used only in list functions. Sets name of CSS class to be used for <TH> tag Example: 'tableheadstyle' => 'kftableheadstyle', |
Not supported in slideshow |
tableheadstyleproperties |
Used only in list functions. Sets CSS properties for <TH> tag Example: 'tableheadstyleproperties'=> 'color:green;', |
Not supported in slideshow |
tablestyle |
Sets name of CSS class to be used for <TABLE> tag Example: 'tablestyle' => 'kftablestyle', |
same |
tablestyleproperties |
Sets CSS properties for the <TABLE > tag Example: 'tablestyleproperties' => 'text-align:center; width:70%;margin-left:auto;margin-right:auto;vertical-align:top', |
same |
windowtarget |
Sets the target= option for the <a> tag. Value can be: _blank-js opens up a js window to display a large image. Requires imagelink to be ‘large’ and preferably imagesize=large also. Otherwise no link _blank-cfshow Same as _blank-js. _blank Opens link in new window not set Opens link in the same window The page opened in a new window depends on the setting of imagelink Example: 'windowtarget' => '_blank-js', |
same |
$source parameter |
Meaning |
Example |
cat |
Category number |
cat=5 or
cat=1,2 |
album |
Album number |
album=3 |
ownerid |
User id of user who uploaded image. Previously owner was used but this was deprecated in Coppermine |
ownerid=22 |
keyword |
Keyword for searching |
keyword=washington |
text |
Searches keyword, title or caption |
text=sunset |
An example of a valid source string is: “cat=1,2:ownerid=22” |
List of
Functions. Those with get or list in their name return text only.
Those with show in their name return text and album or category thumbnails.
Those with view in their name return images. |
|
cpm_formatStats($format) |
Outputs stats based on a format passed in using $format The format is specified by percent sign placeholders '%'. To include a percent sign put two percent signs in a row '%%'. The main supported placeholders are: - %f - file count - %a - album count - %c - category count - %v - view count - %n - comment count (note count) For example: "There are %f files in %c categories containing %a albums, with %v views and %n comments" |
cpm_getAlbumListFrom ($source, $rows, $columns, $options="") |
Returns list of albums in the category that contain images |
cpm_getCategoryList ($options="") |
Retrieves categories that have no albums but not categories without directly connected albums containing public images. |
cpm_getMediaCount ( ) |
Deprecated. Removed. Superceded by cpm_formatStats |
cpm_getMediaCountAddedInLast($numberOfDays) |
Number of items added in last n days |
cpm_getMediaCountAddedSince($timestamp) |
Number of items added since the supplied date |
cpm_getMediaCountForAlbum ($albumid) |
Deprecated. Removed. Superceded by cpm_formatStats |
cpm_listMediaAddedOverLastDays($numberOfDays,$options="") |
Returns summary stats containing category, album name, pic count |
cpm_listMediaCount ( ) |
Deprecated. Removed. Superceded by cpm_formatStats |
cpm_listMediaCountForAlbum ($albumid) |
Returns the number of items in the album |
cpm_listMediaCountFrom ($source ) |
Returns the number of items in the source |
cpm_showAlbumsUpdatedOverLastDays($numberOfDays,$options="") |
Displays a list of albums with thumbnails and count over past days |
cpm_showCategoriesUpdatedOverLastDays($numberOfDays,$options="") |
Displays a list of categories with icons and count over past days |
cpm_viewLastAddedMedia($rows, $columns, $options="") |
Displays images of last added media from anywhere |
cpm_viewLastAddedMediaFrom($source, $rows, $columns, $options="") |
Displays images of last added media for a specific category or album |
cpm_viewLastAddedMediaFromAlbum($rows, $columns, $albumid, $options="") |
Displays images of last added media for a specific album |
cpm_viewLastAddedMediaFromCategory($rows, $columns, $catid, $options="") |
Displays images of last added media for a specific category |
cpm_viewLastCommentedImages($rows, $columns, $options = "") |
Displays most recent images that have received comments |
cpm_viewLastUpdatedAlbumsFrom($source, $rows, $columns, $options="") |
Returns the most recently updated albums and the last photo added to each of them |
cpm_viewMediaFromAlbum($rows, $columns, $albumid, $options="") *NEW* |
Displays media from album(s). Pass sortorder in $options |
cpm_viewMediaFromCategory($rows, $columns, $catid, $options="") *NEW* |
Displays media from category. Pass sortorder in $options |
cpm_viewMediaByPid($pid, $options="") |
Selects one media item by the CPG pid (Picture Id) |
cpm_viewMostVotedMediaFrom ($source, $rows, $columns, $options="") |
Media item receiving the most votes. This is the number of users rating the image, not the overall rating |
cpm_viewRandomMedia($rows, $columns, $options="") |
Displays random images from everywhere. |
cpm_viewRandomMediaFrom($source,$rows, $columns, $options="") |
Displays random images from specific album or category |
cpm_viewRandomMediaFromAlbum ($rows, $columns, $albumid, $options="") |
Displays random images from specific album(s) |
cpm_viewRandomMediaFromCategory ($rows, $columns, $catid, $options="") |
Displays random images from specific categories |
cpm_viewRandomMostViewedMediaFrom ($source, $rows, $columns, $options="") |
Displays random images from those most viewed |
cpm_viewRandomTopRatedMediaFrom ($source, $rows, $columns, $options="") |
Displays random images from those most top rated |
cpm_viewTopRatedMediaFrom ($source, $rows, $columns, $options="") |
Displays the most top rated images |
List of Modules supplied in Zip file
cpmfetch.php |
Main code module |
cpmfetch_config.php |
Created during installation. Contains copy of gallery configuration |
cpmfetch_dao.php |
Data access module for cpmfetch |
cpmrun.php |
File to be called from Wordpress and other web sites which then calls other cpmfetch modules as needed |
cpmslideshow.php |
Runs a slideshow |
install.php |
Installation procedure. Run in web browser |
screen.php |
Used by Install |
slideshow.php |
Runs a slideshow |
testfetch.php |
Test program to test cpmfetch settings when generating a grid of pictures or text. Run in web browser |
testslideshow.php |
Test program to test cpmfetch settings when generating a slide show. Run in web browser |
List of tags which are substituted in titles etc.
Use the following, as an example, to print a subtitle saying “Title is Flowers by John A”.
'subtitle' => 'Title is: {{pTitle}}
by {{uUser_name}}',
Tags marked with a * are unique to cpmfetch and don’t have a direct equivalent in Coppermine
Tags |
|
pFilepath |
The path to the media |
pFilename |
Filename of the media |
pAid |
The album ID the photo belongs to |
pFilesize |
File size in bytes |
pFilesizeKB* |
The medias filesize in KB |
pTitle |
Image title |
pCaption |
Image caption (may be long) |
pOwnerId |
Id number of the uploader |
pCtime |
Picture capture time in Unix format. Use the PHP date(format, Unixtime) function to convert |
pCtimeAgo* |
Number of days since picture was taken |
pCtimeFormatted* |
Date picture was taken |
pHits |
Number of views |
pPid |
Image ID |
pPic_Rating |
Picture rating |
pPic_RatingStars |
Not used anywhere. Always zero. |
pVotes |
Number of votes received by a picture |
pWidth |
Image width in pixels |
pHeight |
Image height in pixels |
pUser1 |
User defined field 1 |
pUser2 |
User defined field 2 |
pUser3 |
User defined field 3 |
pUser4 |
User defined field 4 |
cName |
Category name |
cDescription |
Category description |
cPos |
Position of a category in its parent category. 0 is highest position. Each position lower increases by 1 |
cParent |
Parent category |
cThumb |
Category thumbnail image |
uUser_name |
User name of the uploader |
uUser_lastvisit |
Date & time of uploader’s most recent login |
uUser_regdate |
Date & time of uploader’s registration |
uUser_email |
Email address in uploader’s profile |
uUser_profile1 |
User Profile field 1 |
uUser_profile2 |
User Profile field 2 |
uUser_profile3 |
User Profile field 3 |
uUser_profile4 |
User Profile field 4 |
uUser_profile5 |
User Profile field 5 |
uUser_profile6 |
User Profile field 6 |
aAid |
Album id |
aTitle |
Album name |
aDescription |
Album description |
aVisibility |
group_id of group in album’s “can be viewed by” |
aPos |
Position of album in its category. 100 is the highest position. Each position lower increases by 1 |
aCategory |
Parent category for the album |
aThumb |
Album thumbnail image |
aKeyword |
Album keyword |
fullPathToThumb* |
directory and filename of thumbnail image |
fullPathToNormal* |
directory and filename of intermediate image |
fullPathToFull* |
directory and filename of full size image |
cpmSubtitle* |
This is a text field that can be passed in as a setting in $options, for example : ‘cpmSubtitle’ => ‘Competition Winner’, |
================================================================================
Files supplied
in the Zip file |
|
cpmfetch.php |
Main program |
cpmfetch_config |
Configuration file created by the install procedure. Initial version supplied in the Zip file |
cpmfetch_dao.php |
cpmfetch data access functions |
cpmfetch-detailed-documentation.htm |
The main file for this documentation |
cpmrun.php |
Script to be included into Wordpress or other web site which initiates cpmfetch |
cpmslideshow.php |
Script to be called from web site to run a slideshow |
install.php |
Installer |
loading.png |
Graphic displayed while slideshow is loading |
problem.gif |
Graphic displayed when an image can’t be displayed for whatever reason |
screen.php |
Used by the installer |
testfetch.php |
Program for testing cpmfetch calls used to display static images on a web site |
testslideshow.php |
Program for testing cpmfetch calls used to display slideshow on a web site |
In the /inc directory |
Include files for use with testfetch, testslideshow and Wordpress or other web site |
In the /inc/examples directory |
Includes files using each of the cpmfetch function calls so that they can be tried out without having to create them |