ZyBlog

WordPress, Web Development, SEO and more

Patching the CoppermineSC plugin

| 4 Kommentare

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 ;-)

Gefällt dir der Beitrag? Dann teile ihn!

Ähnliche Artikel:

  1. Plugin Sociable Zyblog Edition V2.0.5
  2. seekXL Snapr Plugin 2.0.3
  3. Reverse Order Comments Plugin ist WordPress 2.0 kompatibel
  4. Plugin Sociable Zyblog Edition V2.0.7
  5. seekXL Snapr Plugin 2.0.2

4 Kommentare

  1. Hi. Kannst Du mir bitte verraten wie du die RANDOM-Galerie in der Sidebar integriert hast ? Ich kann zwar problemlos mehrere Bilder in den Posts einbinden, leider versteht “sidebar.php” nicht den befehl. Danke

  2. Hi Shortie.
    Die Einbindung sieht bei mir in etwa so aus:

    < ?php if (function_exists('cpgsc_sidebar')) {
    cpgsc_sidebar('[cpg_galrand:1]');
    }
    ?>

    Den Block packe ich dann noch in ein Div und formatiere die Ausgabe per Stylesheet.

  3. Kannst du, bzw magst du (ist besser :) mir verraten wie du die diggit/yiggit Buttons da unten ran bekommen hast?

  4. Hi Stefan,

    einfach die single.php deines Themes anpassen.

Hinterlasse eine Antwort

Pflichtfelder sind mit * markiert.

*