CF-Error CF-Error CF-Error
Features of CpmFetchCpmFetch

CpmFetch can pull almost anything out of your Coppermine Photo Gallery.

Please note:

I tend not to update this page that often. As of just before CpmFetch verison 2.0, this page is current. The documentation is the best place to check for feature set availability. If you are really looking for bleeding edge functionality, then the changelog or release notes for the development version is the best source. These can be found on the download page.

In broad terms, CpmFetch can be used in several ways:

  • Display tables of images from your gallery.
  • Display statistics from your gallery.
  • Retrieve data to format as you wish.
  • Extend the CpmFetch object.
  • Generate RSS Feeds.

What sort of data can you pull from CpmFetch
CpmFetch provides functions to get images a number of different ways. From random images and last added media to most popular and most voted on. CpmFetch lets you further narrow the images returned by specifying:

  • single or multiple categories and or albums
  • photo owners name
  • keywords in the keyword field, title, or caption
  • private or public (CpmFetch by default does not access non-public media)
  • media types (jpg, gif, png, etc)

CpmFetch also provides a powerful system for dynamically generating subtitles, alt tags and even the hyperlinks attached to an image. For example, you can specify that the subtitle displayed for every image returned to be set to:

Summer day
From my favorites
Taken by Vuud
Rated 5 out of 5

By using the format

{{pFilename}}
From {{aTitle}}
Taken by {{pOwner_name}}
Rated {{pPic_Rating}} out of 5

CpmFetch supports tags for almost every field in the database, and some that it creates on its own. See the documentation for the full list of entries you can use.

Function to get images or image data back

* Important to note:

Any of the functions that end in "From" allow you to specify combinations of albums, categories, owners, keywords and more. For example, if you set your source to be:
"cat=5,3:album=10,12:owner=vuud:
keyword=alice,bob:text=bicycle"

It will show any pictures from categories 5 or 3, or albums 10 or 12 that are owner by Vuud and that have the keywords alice or bob or titles with bicycle or descriptions like bicycle.

I have left out some functions, since they are redundant and superceeded by newer functions. This will simplify things greatly for beginners. The names should be descriptive enough. If not, check the user guide.
  • cpm_viewLastCommentedImages
  • cpm_listMediaAddedOverLastDays
  • cpm_showAlbumsUpdatedOverLastDays
  • cpm_showCategoriesUpdatedOverLastDays
  • cpm_viewLastAddedMediaFrom
  • cpm_viewRandomMediaFrom *
  • cpm_viewTopRatedMediaFrom *
  • cpm_viewRandomTopRatedMediaFrom *
  • cpm_viewMostVotedMediaFrom *
  • cpm_viewRandomMostViewedMediaFrom *

Functions the return statistics
Some functions are designed to return simple statistics. Here is a sample of the sort of functions that you will have access to with CpmFetch

  • cpm_formatStats
  • cpm_listMediaCount
  • cpm_getMediaCount
  • cpm_listMediaCountForAlbum
  • cpm_getMediaCountForAlbum
  • cpm_getVersion
  • getAlbumCount
  • getCommentCount
  • getViewcount
  • getCategoryCount

Finely tuned control
CpmFetch can be tweaked and twisted to act however you want. When you install, a configuration file is created that allows you to edit much of the behavior, down to even modifying the MySQL calls it makes. Some functions are provided to allow you to control the behavior at run time. Here are some of them:

  • cpm_setFilter
  • cpm_debugMode
  • cpm_unlock_private
  • cpm_setDateFormat
  • cpm_getConfigEntry
Of course there are more, but the above gives you the idea

The result type - I think this is the best
CpmFetch can display grids of images for you - but what it can also do is just give you back data. A programmer with minimal PHP skills can foreach through the results and display it however he wants. Almost all of the above calls to return images, can return an array of data for each image instead.

This data not only provides you with the data from the CPG database, but also returns information about the thumbnails, the precalculated link, subtitles and much more. This makes it easy to extend CpmFetch in ways I have not thought of yet.

Here is a print_r (PHP's function to print arrays) of an image's data

Example of resultset data for one image

[0] => Array ( [pFilepath] => userpics/10002/ [pFilename] => img_3139.jpg [pAid] => 2 [pFilesize] => 86612 [pTitle] => Buddha [pCaption] => Big buddha decription [pOwner_name] => testuser1 [pOwnerId] => 2 [pCtime] => 1168138283 [pHits] => 1 [pPid] => 3 [pPic_Rating] => 0 [pVotes] => 0 [pWidth] => 1024 [pHeight] => 768 [pUser1] => [pUser2] => [pUser3] => [pUser4] => [cCid] => [cName] => [cDescription] => [cPos] => [cParent] => [cThumb] => [uUser_lastvisit] => 2007-01-06 21:50:16 [uUser_regdate] => 2007-01-06 16:36:00 [uUser_email] => bill@explosivo.com [uUser_profile1] => [uUser_profile2] => [uUser_profile3] => [uUser_profile4] => [uUser_profile5] => [uUser_profile6] => [aAid] => 2 [aTitle] => testuser1_albumOne [aDescription] => [aVisibility] => 0 [aPos] => 1 [aCategory] => 10002 [aThumb] => 5 [aKeyword] => [fullPathToThumb] => http://cpg.localhost.com/albums/userpics/10002/thumb_img_3139.jpg [fullPathToNormal] => http://cpg.localhost.com/albums/userpics/10002/normal_img_3139.jpg [fullPathToFull] => http://cpg.localhost.com/albums/userpics/10002/img_3139.jpg )