Selecting specific albums and categories

Being able to narrow down the source of your displayed images is a big part of CpmFetch. For example, on my web site I show Linux screenshots on my Linux pages - but draw them from my CPG archive.

There are several functions that help you do this, but I will only explain how to use the newer and, IMHO, better ways. Moving forward, this is how I will be working with things, so you better get used to it.

The following functions (and more may be added or already exist) all accept a $source string as one of the parameters. The $source string tells CpmFetch that you either do not care where they come from - in the case of submitting an empty string, or omitting it - to specifying one or more albums, categories or even combinations of both.

cpm_viewLastAddedMediaFrom ( $rows, $columns, $source, [array $options = ""])
cpm_viewMostVotedMediaFrom ($source, $rows, $columns, [array $options = ""])
cpm_viewRandomMediaFrom ( $rows, $columns, $source, [array $options = ""])
cpm_viewTopRatedMediaFrom ($source, $rows, $columns, [array $options=""])
cpm_viewRandomMostViewedMediaFrom($source, $rows, $columns, $options)
cpm_viewRandomTopRatedMediaFrom($source, $rows, $columns, $options)

You create the $source string by adding a comma seperated list of albums and categories starting with either cat=, album=and / or owner= each section seperated by a colon. There is one very special category you need to know about. Category 1 represents the user galleries. So if you ask for cat=1 it will include all of those. This is done through some internal wizardry.

The owner tag is followed by the text version of one or more users names. This will then source any photos owned by them. Owner= was added in version 1.5.1

For example:

Example 5.3. Source string examples


// Would include categories 2 and 3 along with albums 10, 12 and 13.
$source = "cat=2,3:album=12,13,10";

// Would include all of the categories and albums
$source = "";

// Would include only member galleries
$source = "cat=1";

// Would include albums 1,2,5
$source = "album=1,2,5";

// Would include categories 6, 7 and every member gallery
$source = "cat=6,7,1;

// Would include every member gallery and album 51
$source = "cat=1:album=51";

// As with all variables in PHP, they can be created on thier own 
// line as shown above, or simply take the quoted contents and 
// add them directly to the function call.
$objCpm->cpm_viewLastAddedMediaFrom (1,1, "cat=1:album=51");

// If you plan on passing an options array to the function, you need to 
// send an empty string - you may not ommit the source string in that case.
$objCpm->cpm_viewLastAddedMediaFrom (1,1, "",$optionarray);