Getting images in RSS feeds Getting images in RSS feeds
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Getting images in RSS feeds

Started by divestoclimb, June 10, 2009, 06:39:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

divestoclimb

(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/';

steveski

I am having this same problem, except with Facebook - it doesn't get the images.  Is there a fix beyond the code changes mentioned here?