I’ve put together a Plugin for widgetizing cpmfetch functions for wordpress. CPMFetch is short for Copperminefetch, a php-program that helps pulling data from Coppermine gallery.
While building my new theme i made 3 short widgets which i seperated from the theme and put into it’s own plugin.

Right now CPMFetch Widgets Plugin provides 4 Widgets:

  • cpmfbase: provides a simple text-header - this could also be done using a Text-Widget and makes only sense if you use more than one CPMFetch Widget. You can put it above the other CPMFetch Widgets and use it as a common title. Title can be configured using Widget-Administration.
  • cpmfrecent: This Widget shows the recently added pictures to your Coppermine gallery. You can configure Title, Thumbnailwidth, Number of Columns/Rows, Linktype and style from the Widget-Administation.
  • cpmfrandom: This Widget shows randomly selected pictures from your Coppermine gallery. You can configure Title, Thumbnailwidth, Number of Columns/Rows, Linktype and style from the Widget-Administation.
  • cpmfmostviewed: This Widget shows the most viewed pictures to your Coppermine gallery. You can configure Title, Thumbnailwidth, Number of Columns/Rows, Linktype and style from the Widget-Administation.

Feel free to pull CPMFetch Widget and enhance it, i only put the functions inside that i needed for my site. CPMFetch comes with a load of more functions, i think it might be really nice to have a widget that fully supports CoppermineFetch!

Installation:

  • Download from blog.stieglmayer.com/downloads/cpmfetch_widget.zip
  • Unzip into your wordpress/wp-content/plugins directory
  • Go to Administration/Plugins
  • Activate the plugin
  • Go to Administration/Plugins/CPMFetch Widget Subpage and enter the full path to your cpmfetch-file (e.g. /home/<username>/www/cpmfetch/cpmfetch.php)
  • Go to Presentation/Sidebar Widgets and configure the Widgets.

Requirements:

Hints:

35 Responses to “CPMFetch Widget”

  1. martinick says:

    somehow i managed to delete a coment from someone having troubles with the widget… maybe you will read this though…

    1st step: is coppermine running?
    2nd step: install cpmfetch and run the tests described on the cpmfetch-site - does it work on it’s own?
    3rd step - install my widget in your wordpress blog and set the exact path to your cpmfetch.php file as described - viola, that’s it… if you need to find out your full path to cpmfetch open up a shell, nagivate to the directory hosting cpmfetch and type “pwd” to get the path… don’t forget to add the cpm_fetch.php (or whatever you named it!) file in string you enter in the widgets options…

  2. Hi says:

    Everything works but what to do with Presentation/Sidebar Widgets and configure the Widgets…
    I’m not an expert… I don’t know how to make a code which should be inserted into sidebar..
    Thx

  3. martinick says:

    Hello “Hi”

    there is no need to put anything manually into the sidebar, the only thing you need is to get your wordpress installation widget-ready - e.g. install the “Sidebar Widgets” plugin, activate it and then you will be able to configure your sidebar using your mouse… just make shure to de-activate and reactivate the widgets you installed (cpmfetch-widget??) before installing the “sidebar widgets” plugin, in order to get the widgets registered properly!

  4. Tom says:

    Hi there,
    I just don’t get it :-(

    with the 1.6.4 version of cpmfetch i’m getting the following error message:
    Fatal error: Call to a member function on a non-object in /path/snipped//wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php on line 135

    and with 1.9.11 there is just nothing displayed

    the install / test script of cpmfetch is working just perfect… What am I doing wrong?

  5. Vuud says:

    Hello!

    For some reason I came across this - and want to personally thank you for developing and posting something that extends cpmFetch!

    The new stable release will be out soon, and seriously improves upon the 1.6 series.

    Anyway, I’d like to talk to you about including references to this in my new doc’s and such, or including it in the cpmfetch download. Either way. Also, if there is anything cpmfetch can do to make your development easier - let me know.

    Thanks again,

    Vuud

    (PS. Pls mail me directly, not sure if I will remember to check back here)

  6. martinick says:

    @Vuud - you have email!

    @Tom: as you can read above, i am using CPMFetch Version 1.9.5 and Coppermine Gallery 1.4.10.
    the error message sounds like there is a function in cpmfetch which my widget tries to call that is not there. -> looks like version 1.6.4 has some differences to 1.9.5

    i’d simply get the 1.9.5 version which is working with my widget.

    on the other hand - there is no error message with cpmfetch 1.9.11, no pictures showed though. so this might also be the point to try to debug why there are no images displayed… maybe it’s because some of the paths are not correct? did you look at the source of the generated page if the links to the images contain any path? is it the correct path? just an idea…

  7. daan says:

    Hey

    Ive got a bit of a problem…

    I have installed cpmfetch, and i think it is working because it showed random images, but when i try to use you great widget, and i try to get random images from my gallery
    all i see instead of images is this”:

    Warning: cfw_cpmf_mostviewed(): Unable to access /public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php in /storage/mijndomein/users/036252/public/sites/www.daand.com/website/wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php on line 105

    Warning: cfw_cpmf_mostviewed(/public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php): failed to open stream: No such file or directory in /storage/mijndomein/users/036252/public/sites/www.daand.com/website/wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php on line 105

    Warning: cfw_cpmf_mostviewed(): Failed opening ‘/public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php’ for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in /storage/mijndomein/users/036252/public/sites/www.daand.com/website/wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php on line 105

    Fatal error: Cannot instantiate non-existent class: cpm in /storage/mijndomein/users/036252/public/sites/www.daand.com/website/wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php on line 106

    which i dont really like,
    Can you help me please?

  8. martinick says:

    daan, i guess the solution to your problem is already inside your comment… :)

    once cpm-fetch is running (assured via the tests on the cpm-fetch site?) and you have the widget added to your side bar everything should be working.
    you need to set the path to the cpmfetch.php inside the Administration/Plugins/CPMFetch Widget Subpage of wordpress.
    and here is the point. you did this, but it looks like this is the wrong path.

    the reason for the error message occuring while PHP is running my widget in:

    /storage/mijndomein/users/036252/public/sites/www.daand.com/website/wp-content/plugins/cpmfetch_widget/cpmfetch_widget.php

    is that php can not access the cpmfetch.php file in:

    /public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php

    you already entered the location, but it looks like the beginning of the path is not /public/sites… but is /storage/… instead.

    so my guess would be: change the path in Administration/Plugins/CPMFetch Widget Subpage to cpmfetch.php from this:
    /public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php
    to
    /storage/mijndomein/users/036252/public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch.php

    and that should be it.
    i hope that helps!

  9. daan says:

    Great
    Thanks you helped me so much, but now this creates another small problem…

    this is the error message i get..

    Error: config file /cpg specified but was not found.

    I dont know what config file is meant or where to find it or what to do with it…
    cpmfetch is working so that isnt the problem…
    when i asked this question on a other board they told my to contact the widget creator, so i hoe you know what is wrong, because i like your widget damn much.
    thanks in advance for reacting so fast to my messages.. :D

  10. martinick says:

    Hello Daan!

    if you follow my link under “hints” to http://blog.stieglmayer.com/2007-01-04-more-things-updated/, and look under step 3 - there are the hints for you… also if you follow the link from there to martinsland.de…

    the error message is generated by cpmfetch_dao.php - a file beeing part of cpmfetch.
    my cpmfetch_dao.php looks like this and it works - basically it only executes the require_once command and everything else dealing with the config-file include until “$this->cfg…” is deleted .

    to be on the safe side - make a backup of that file before changing it!
    and of course… you have to change PATHTOCPMFETCH with your path…

    // Initializes the object
    function cpm_dao($config_file = “”) {

    require_once(”/PATHTOCPMFETCH/cpmfetch_config.php”);
    // Load config settings
    $this->cfg =
    array_merge(getDefaults(),

  11. daan says:

    Ahhhw… i am getting an error again:
    this is the code i changed in the cpmfetch_dao.php file in cpmtfetch:

    // Initializes the object
    function cpm_dao($config_file = “”) {

    require_once(”/storage/mijndomein/users/036252/public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch_config.php”);
    // Load config settings
    $this->cfg =
    array_merge(getDefaults(),

    if ($config_file == “”) {
    if (file_exists(”cpmfetch_config.php”)) {
    require(”cpmfetch_config.php”);
    }

    I get this error:

    Parse error: parse error, unexpected T_IF in /storage/mijndomein/users/036252/public/sites/www.daand.com/Gallery/cpmfetch/cpmfetch_dao.php on line 71

    Can you help me again please?

  12. WP Plugins DB » Blog Archive » CPMFetch Widget says:

    [...] Visit [...]

  13. Gerrit says:

    Hi there, Ive been having a similar problem as the person above. I get the error

    Error: config file /cpg specified but was not found.

    I read your Page about how you fixed the problem, But I didnt understand it. My Dao.php is huge and I need more info on how to fix this.

    Can you email me or reply with a more detailed message. Thanks,…

  14. Johanna says:

    Hi ya,
    I just installed your widget but it seems to give me this error: “Error: config file /cpg specified but was not found.” I have the latest stable version of coppermine and the folks at the coppermine board said that the trouble is with the widget.. so I guess it doesn’t work anymore with the latest CPM gallery version?

  15. martinick says:

    Johanna,

    i have no idea about the newest coppermine version and if it works with cpmfetch or cpmfetch-widget. point is: cpmfetch-widget does not use functions from coppermine. it uses functions from cpmfetch.
    so the chain is coppermine<>cpmfetch<>cpmfetchwidget<>wordpress.
    so coppermine needs to fit cpmfetch, cpmfetchwidget needs to fit cpmfetch and cpmfetchwidget needs to fit with wordpress.

    the error you get is not a new error. and it is inside cpmfetch. at least it was in my installation and it seems to be in your installation and in Daan’s installation.

    when i installed my widget i wrote about this error.
    when the error occured with Daan, i put a hint where to read in my comment from 9th May 2007.
    and now the same error is with you, so i also advise you to read my entry from 4th January and there you will find the hints to solve your error.

    in case you use a different version of wordpress/widget plugin/cpmfetch the problem can be different though… but as i do not use it and not even have the time to upgrade mine - sorry, that’s a problem you have to solve.
    off course it would be nice to have some documentation along with version-numbers of the modules in order to have the next people have it easier.

  16. Rudy Engels says:

    Martin,

    I installed your fantastic plugin and had some problems. First one was the wrong path and second one the dao modificication. It seems to work now ;-)
    One question: what’s the linktype? No matter what I choose here, everything seems the same or am I overlooking something?
    One can only hope that this plugin will grow with other possibilities so everyone can use cpmfetch. Thanks again!

  17. Tim says:

    Hi, I have the following error:

    Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/cpg) is not within the allowed path(s): (/www/htdocs/v130436/:/tmp:/usr/bin:/www/htdocs/v130436:/bin:/usr/local/bin:/usr/share/php) in /www/htdocs/v130436/galerie/cpmfetch/cpmfetch_dao.php on line 79
    Error: config file /cpg specified but was not found.

    The path to cpmfetch is correct. I have test your fix: http://www.martinsland.de/wordpress/?p=19, but it doesn´t work…

    Do you have any idea?

  18. martinick says:

    Hi Tim!

    there is a problem with your php-configuration, as the error message you posted shows “Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/cpg) is not within the allowed path(s):”
    this means that there is some setting “open_basedir” in your php-configuration that does not allow to include the /cpg… files.

    so get your hoster or your admin to change this setting and it should work.

    alternatively you could try to use absolue paths (/home/user/…/…) or relative paths like ../../cpg to fix the problem. at least that’s what i would try, but i guess it might be good to look up the open_basedir setting in the php documentation.

    Good Luck!

    btw, martinsland.de/… is not my fix and it’s not even my site.

  19. martinick says:

    Rudy!

    except for the frist parameter “title” all the parameters are passed to cpmfetch.
    cpmfetch uses those parameters when generating the html-code, so it knows how you want the links behind each thumbnail displayed.
    so you can choose to open the link associated with the clicked thumb in a new windows (linktarget parameter) e.g.

    linktype should change the target of the link… so if there should be no link (none) at all, if it should display a full-size version of the displayed thumb (full) or if it should open a page with the entire coppermine album that the clicked thumb is in.

    as i can’t remember how exactly cpmfetch parses the parameter - i have entered them in small letters - so e.g. ‘full’. and at least when i installed the coppermine/wordpress/cpmfetch/widget thing it worked for me.

    Regards, Martin.

    so you can choose

  20. Billy Steen says:

    martinick,
    I’m hoping you can help me here. I’ll kick off an say blogging and widgets are a bit new to me, so bare with me.
    I’ve followed all the instructions you’ve published, including installing CPMFetch.
    I’m now at the point of configuring your widget. I’ve add the correct path and clicked the update button. The page reloads and I get the path displayed at the top of the page with a exclamation mark. I’m pretty sure there is an error but I can’t seem to find what the errors is.
    I’m using the latest version of the widget, CPMFetch and Coppermine.
    Any help you can supply will be greatly appreciated
    Many thanks
    Billy

  21. Juliana says:

    Hi Martin

    Thank you so much for sharing your widget with fellow wordpress/cpmfetch users.

    I have successfully installed cpmfetch and have put your widget in my wordpress plugins folder. I then added the widget (the random image one) to my sidebar and then set the path for cpmfetch. Upon doing so, I got the follow error message:

    Warning: cfw_cpmf_random(home2/hamishc/www.hamishclarkfansite.com/public_html/cpmfetch/cpmfetch.php) [function.cfw-cpmf-random]: failed to open stream: No such file or directory in /home2/hamishc/public_html/wp-content/plugins/cpmfetch_widget.php on line 128

    Warning: cfw_cpmf_random() [function.include]: Failed opening ‘home2/hamishc/www.hamishclarkfansite.com/public_html/cpmfetch/cpmfetch.php’ for inclusion (include_path=’.:/opt/php4/lib/php’) in /home2/hamishc/public_html/wp-content/plugins/cpmfetch_widget.php on line 128

    Fatal error: Cannot instantiate non-existent class: cpm in /home2/hamishc/public_html/wp-content/plugins/cpmfetch_widget.php on line 129

    Could you please help me work out what I’m doing wrong? I’m about to go to London (I live in Sydney Australia) for a month’s holiday & would love to be able to get this sorted out beforehand.

    Thank you so much
    Jules

    PS: I’m going to remove the widget temporarily from my sidebar until I can find out what I’m doing wrong.

  22. martinick says:

    Juliana!

    i guess the error is showed in your post above:
    In the 2nd block starting with “warning:” the 1st path is:
    “home2/hamishc/www.hamishclarkfansite.com/public_html/cpmfetch/cpmfetch.php”
    this should be starting with “/home2/…” at least and not without the leading “/”.

    that might be the solution, but i guess there is another problem as well:
    the 2nd path mentioned in the same warning-statement:
    “/home2/hamishc/public_html/wp-content/plugins/cpmfetch_widget.php”

    so i see: you have installed cpmfetch_widget inside the wordpress installation-directory, which ist:
    “/home2/hamishc/public_html/wp-content/plugins/”

    you set the include path for cpmfetch.php to:
    “home2/hamishc/www.hamishclarkfansite.com/public_html/cpmfetch/cpmfetch.php”
    beside the missing “/” in the beginning, do you see the difference…? that’s a totally different path…

    so if you can access your files via shell try cd-ing to the cpmfetch.php dir above and type “pwd” - it will show you the complete path… is it the same as the one above…?

    i guess that is the mistake you made… once you use http://www.hamischclarkfansite.com in the path and once not…

  23. martinick says:

    Gerrit, sorry, seems like i’Ve overseen your comment back in June!

    sorry, but i can not help you here. i will not be editing your files, and the information you need is already in the posts above and linked from this post….

    just get the file, make a backup copy of it first!, fire up your favourite text-editor and search for the text-parts/function names mentioned… see if you find it more than once (which should not be the case) and replace it as written. viola.

    to have it easier you can use some program like codepad, pspad,… those editors allow you to search for a text not only in the opened files but in all files within a directory…

    good luck!

  24. martinick says:

    Billy!

    sounds weird to me… can you send me the saved html-page where this
    “The page reloads and I get the path displayed at the top of the page with a exclamation mark. I’m pretty sure there is an error but I can’t seem to find what the errors is.”
    happens..?

    so i can locate this ?error? easier, right now i don’t have a clue where this shows up!

    Thanks!

  25. EricsProjects says:

    First, let me say this is a Great Widget and a Great BIG Thanks for making it!

    Second,

    To those with the error:

    Error: config file /cpg specified but was not found.

    Here is what worked for me. I went into the cpmfetch_dao.php file (located in the cpmfetch folder). Down about 70 lines, you will see the line:

    function cpm_dao($config_file = “”) {

    Just below it, enter a line like this one, but use the same path that you entered when you configured the CPMFetch Widget. You are entering ing the explicit path to the cpmfetch_config.php file.

    $config_file = “/var/www/domains/ericsprojects.com/docs/cpg/cpmfetch/cpmfetch_config.php”;

    If you have any questions, post ‘em here, then send me an e-mail, I’ll come back and answer.

    Good Luck !

    -Eric (ericsprojects AT gmail DOT com)

  26. Richard says:

    I get this error message:

    Error: config file /cpg specified but was not found.

    What mistake did I make?

  27. Richard says:

    This is the path i used:

    /home/monarchh/public_html/gallerynew/cpmfetch/cpmfetch.php

  28. Richard says:

    I did the change to the dao.php file.

    I no longer get the confir error.

    I now get:

    Fatal error: Cannot instantiate non-existent class: cpm in /home/monarchh/public_html/wordpress/wp-content/plugins/cpmfetch_widget.php on line 129

    The only thin on line 129 is }

    This is the path I am using.

    /home/monarchh/public_html/gallerynew/cpmfetch/cpmfetch_config.php

    I need your help. I really need this to work.

  29. Debra says:

    I have coppermine in one directory and wordpress in another.
    I’ve installed the widget and set the path - home/debrag/public_html/georgieparker/gallery/cpmfetch/cpm_fetch.php but I get the error:

    Warning: cfw_cpmf_recent(/home/debrag/public_html/georgieparker/gallery/cpmfetch/cpm_fetch.php) [function.cfw-cpmf-recent]: failed to open stream: No such file or directory in /home/debrag/public_html/georgieparker/site/wp-content/plugins/cpmfetch_widget.php on line 82

    Warning: cfw_cpmf_recent() [function.include]: Failed opening ‘/home/debrag/public_html/georgieparker/gallery/cpmfetch/cpm_fetch.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/debrag/public_html/georgieparker/site/wp-content/plugins/cpmfetch_widget.php on line 82

    Fatal error: Cannot instantiate non-existent class: cpm in /home/debrag/public_html/georgieparker/site/wp-content/plugins/cpmfetch_widget.php on line 83

  30. Debra says:

    sorry I realised my php file was typed wrong it was cpmfetch.php not cpm_fetch.php I now have the error:

    Error: config file /cpg specified but was not found.

  31. debra says:

    was my comment deleted?

    I get the error:

    Error: config file /cpg specified but was not found

  32. LovelyFlower says:

    Wow, this plugin is like falling out of the sky as if I never knew it existed! I just typed in randomly wordpress cpg plugin and look what I found! Truly amazing, thanks for making this wonderful plugin, I really appreciate it!

    But before I can enjoy from it, I also have some problems. I don’t get any error, everything is installed correctly. If I activate the plugin, half of my index page is missing(the loop and one sidebar, it’s three column). If I deactivate it, everything is back again. What did I do wrong?

  33. Kevin Davis says:

    The fix I found for the /cpg error is actually in the widget file itself.

    Search for:

    new cpm(’/cpg’);

    I beleive there are 3 or 4 occurrances of it. One for each widget.

    Replace ‘/cpg’ with the path to your cpmfetch config file.

    For example, here is what I changed mine to.

    new cpm(’./photos/cpmfetch/cpmfetch_config.php’);

    After the change, it worked.

    Kevin

  34. the good says:

    First, I want to thank you for this plugin, which opens up many possibilities to easily present your pictures.
    Unfortunately, I can’t adjust the size of the thumbnails. Regardless of the value I put in the field for the thumbnailwitdh the widget just uses the original width of the thumbnailfile from the gallery.
    What did I wrong? The Settings of the other fields are working.
    I’ve tried CPMFetch 1.9.5; 1.9.6; 1.9.12 and 2.0.0 - they all worked except of the setting for the thumbnails. I’m using Coppermine 1.4.14 and wordpress 2.3.2

  35. nick33 says:

    Thanks for your program, now it works fine !!!

    For my site I used this code:

    function cpm_dao($config_file = “”) {

    require(”/home/mysite/public_html/gallery/cpmfetch/cpmfetch_config.php”);

    // Load config settings
    $this->cfg =

Leave a Reply

Close
E-mail It