Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Getting images in RSS feeds  (Read 6365 times)

0 Members and 1 Guest are viewing this topic.

divestoclimb

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 16
Getting images in RSS feeds
« on: June 10, 2009, 06:39:56 pm »

(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:
Code: [Select]
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:
Code: [Select]
$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:
Code: [Select]
$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/';
Logged

steveski

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Getting images in RSS feeds
« Reply #1 on: August 09, 2010, 08:19:44 pm »

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?
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 17 queries.