(I hope this isn't just me having my stuff set up wrong, but I've been playing with lots of different combinations and I think it's right. This appears to be a bug.)
I was trying to use cpmfetch to set up RSS feeds. I ran into a problem, though, that once I got all the "CF error" messages to go away I wasn't getting valid image URLs in the RSS item descriptions. The img tags' src attributes looked like "albums/thumbs/..." instead of being an absolute URL to the images. I suppose relative image URL's could work if I put my rss feed page in the coppermine top-level folder instead of inside cpmfetch, but then the rest of CpmFetch breaks (finding the temporary directory, config file, ...)
I dug through the source and found that the image URL was being set in cfrssget.php via the getImageToUse method in cpmfetch_dao.php:
if (file_exists($this->cfg['cfFilesystemPathToAlbums'] . $filepath . $fileprefix . $filename)) {
$imagetoshow = $this->cfg['fullpath'] . $filepath . $fileprefix . $filename;
}
elseif ($fileprefix == $this->cfg['normal_pfx']) {
$imagetoshow = $this->cfg['fullpath'] . $filepath . $this->cfg['normal_pfx'] . $filename;
}
elseif ($fileprefix == "") {
$imagetoshow = $this->cfg['fullpath'] . $filepath . $filename;
}
else {
print "CF-Error <!-- GITU: Could not find any image to display: Extension (strtolower): $extension File:" . $this->cfg['cfFilesystemPathToAlbums'] . ' ' . $filepath . ' ' . $fileprefix . ' ' . $filename . "--> \n";
}
...from this I inferred that I needed to set the 'fullpath' config variable to the absolute URL of my site... nope.
When I did this, I realized cfFilesystemPathToAlbums was being assembled using fullpath, and doing this would break the script's ability to find the image files themselves.
The only solution I could come up with was to modify cfrssget.php at line 209:
$imagetag = '<a href="' . $item->link . '"><img src="'.
$this->cpm->cfg['cpg_url'] . // added
$this->cpm->urlEncodeImagePath($this->cpm->getImageToUse($data['pFilepath'],$data['pFilename'], $this->cpm->cfg['thumb_pfx'])) . '" align="right" /></a>';
This immediately solved my problem. Is there something I'm missing in my config, or is this a bug?
My relevant config settings:
$config_overrides['filesystem_path_to_cpg'] = '<path>/gallery';
$config_cpmfetchSettings['cpg_url'] = 'http://domain/gallery/';
$config_overrides['cpg_album_url'] = 'http://domain/gallery/albums/';
$config_overrides['fullpath'] = 'albums/';