Tag Archives: cpmfetch

Added CpmFetch to WordPress blog

I have added CPM Fetch to my blog. The author, vuud, describes CpmFetch as:

…a PHP object that allows you to easily display random or latest images from your coppermine gallery on external php and html pages… You can draw images (random or otherwise) from the entire gallery, a specific category or a single album.

I’m using CpmFetch to display a random image from my gallery. You can see it in the sidebar.

The code to put into the theme’s sidebar file is:

	<li>Random Photo</li>
		<div align="center">
		$objCpm = new cpm("$cpm");
		$options = array( 'subtitle' => '<a href="http://takethu.com/displayimage.php?pos=-%i">Details</a><br/>
										Album: %a<br/>
							'imagelink' => 'large',
							"linkstyle" => 'highslide" onclick="return hs.expand(this)" onmouseover="self.status='Click to enlarge thumbnail'; return true;',
		$objCpm->cpm_viewRandomMedia(1,1, $options);



I defined the cpm variables earlier in my file based on if it is the local or remote installation. You can either create and define the variables with your settings or just replace the variables with your own settings.

The code is written to work with Highslide JS so you would need to tweak the code if you don’t want to use it.