To display a random image from my coppermine gallery inside my blog, I found Brad Guilford’s plugin CoppermineSC 0.4.3.
The installation was easy and everything seemed to be working.
But then I noticed that some thumbnails were broken. Although the link to the image was working.
I managed to track the error down to “special” characters in the filepath, like the german Umlaute (öäüß), which I used for the album and category names.
The fix was simple:
I replaced the original code in line 717
$uri = $config[0].$separatorslash.$config[1].$image->filepath;
with
$tmpfilepaths = explode("/", $image->filepath);
$cleanfilepaths = array();
foreach($tmpfilepaths as $val) {
$cleanfilepaths[] = rawurlencode($val);
}
$newfilepath = implode ("/", $cleanfilepaths);
$uri = $config[0].$separatorslash.$config[1].$newfilepath;
As you can see, it is a simple fix. Take the filepath, split it up. Encode each part and join the parts back together.
This patch is just working for the thumbnail display! There are more places like this inside the plugin-code.
But as I am lazy and only need a working thumbnail display, I didn’t do more changes to the code ![]()