Patching the CoppermineSC plugin

Anzeige

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

Bookmarken bei Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können.
  • MisterWong
  • Y!GG
  • Webnews
  • Linkarena
  • Oneview
  • Tausendreporter
  • SEOigg
  • Digg
  • del.icio.us
  • StumbleUpon
  • Folkd
  • Furl

Ä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

4 Kommentare zu „Patching the CoppermineSC plugin“

  1. shOrtie sagt:

    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. Tim sagt:

    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. Tim sagt:

    Hi Stefan,

    einfach die single.php deines Themes anpassen.

Kommentieren

Sie können diese HTML Elemente nutzen:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>