Wordpress Coppermine Widget
Introduction
My Wordpress Coppermine plug-in is a widget that shows a number of thumbnails from a Coppermine web gallery in the sidebar of a Wordpress blog. Moving the mouse over a thumbnail will display a pop-up of a larger version of the image together with the title and description from the gallery. The pop up will hide a short time after moving the mouse out of the image.
Description
The Wordpress plug-in supplies a widget that will display a configurable number of images, in a configurable grid, selected in a configurable way, from a Coppermine Gallery. When the pointer is placed over an image a larger version of the image will be displayed in a pop-up together with any title and description.
The plug-in supplies a settings page which allows the user to enter the Coppermine database details. The widget is a fully compliant Wordpress widget and can be configured using a form on the widget’s appearance page.
On the appearance form you can choose to select how many images to display and the shape of grid in which to didsplay them. You can choose whether to select random, or the latest images, from either all of the images or a specific album. You can also enter the text to display as the widget title.
Download
The plug-in is available from the Wordpress site at:
http://wordpress.org/extend/plugins/wp-cpg-widget/
Known Issues
The path for the JavaScript and Style Sheet documents is incorrect. This path is provided by wp-cpg-widget.php. The partial string “plugins/wp-cpg-plugin” should be replaced by “plugins/wp-cpg-widget”. This will be fixed ASAP as a point release. – Fixed in 1.0.1
Error on activation: "Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in …/wp-content/plugins/wp-cpg-widget/cpg_database.php on line 39" – Addressed in 1.0.2
Page not found error when saving database details from the WP Coppermine settings page – Fixed in 1.0.2
Warnings from PHP when displaying management pages. – Fixed in 1.0.2
The Future
It is intended to add tag support to the plug-in to extend the integration to the inclusion of images in posts and pages. These images will, optionally, also support the pop-up which could either show a larger version of the image or just any title and caption associated with the image. It is also proposed to add support for multiple galleries.
Forums
The are now web forums associated with this blog which include an area to discuss the Wordpress Coppermine widget. These can be found here.




May 19th, 2009 at 8:48 pm
[...] WP Coppermine Plugin von Cyberspice zeigt ausgesuchte Bilder aus dem mächtigen Coppermine Galeriescript in der [...]
May 20th, 2009 at 2:26 pm
Hi,
I installed the plugin at my wordpress setup at http://www.rondvierkant.nl and it does show the widget and when i take a look at the source code it does seem to build the div block. But no thumbs appear on screen. What could cause that?
Cheers
Hein
May 20th, 2009 at 4:51 pm
Hi Hein,
I have looked at your site using firebug (a great web debugging tool) and can see that your URLs in the widget do not have ‘http://’ on the start.
You will need to deactivate the plug-in and reactivate it and reconfigure it using ‘http://fotoalbum.rondvierkant.nl/’ as the URL for the Coppermine gallery. That will fix the problem.
I will update the instructions and the screen to indicate you need the ‘http://’
Regards
Melanie
May 20th, 2009 at 7:18 pm
Great. Works like a charm!
Looking forward to the future improvements.
May 20th, 2009 at 7:53 pm
Could you please provide an example for each of the WP Coppermine Default Gallery Option Screens? Most are obvious, but “the table prefix?”
Thanks.
May 21st, 2009 at 11:03 am
At table prefix you are meant to fill in what the table prefix is like for your cpg in the mysql database. For example cpg14x_ or cpg_
May 24th, 2009 at 9:39 pm
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘navjot’@'localhost’ (using password: NO) in /wp-content/plugins/wp-cpg-widget/cpg_database.php on line 158
Error
Cannot connect to database server! –
Help fix this error.
I have double checked the data and entered the gallery url without or without ending tags to check for error but it does not work out.
http://www.geneliaonline.in
May 26th, 2009 at 11:11 am
Hi “Genelia Online”.
I need more information to help.
Was this error when you entered the Coppermine details on the Settings page? Or did that work successful but you had problems when using the plug-in itself?
The error suggests that the account requires a password but you didn’t give it one. Did you enter the database user password?
Finally what versions of PHP and MySQL, Wordpress and Coppermine, are you using?
Thanks.
Mel.
May 27th, 2009 at 8:23 am
I would like to use Coppermine as my photo gallery on my blog but can’t get it to load. Can you advise. I have tried to load it using filezilla and WP Plug-ins page, but neither works. I am a newbie to website creation, obviously.
Thanks, Tom
May 27th, 2009 at 3:16 pm
Hi Tom,
Coppermine is a separate web application. It is available here. You will need some access to the web server to be able to upload it.
The way I have it installed is that I have my Wordpress blog installed in a directory called ‘blog’ on my server and Coppermine installed at the same level in a directory called ‘gallery’. I installed it simply by following the Coppermine install instructions (Upload the zip or tgz, unpack it, and edit the config file).
Once you have Coppermine installed you can then install my plug-in and fill in the details you used when setting up Coppermine. I’m afraid I don’t have time to go through a whole Coppermine install but there is a help forum on the Coppermine web site so you can get help there.
Good luck.
Mel.
May 29th, 2009 at 10:29 pm
Hello Mel! Thanks a lot for the plugin, it works perfectly and enables me for a nice fotostrip at my page. I wast just having two questions:
1 – is it possible to open the pictures in a new window when you click them?
2 – is it possible to redirect to the enlarged version of the picture instead of to the album?
Thanks in advance!
Rein
June 2nd, 2009 at 8:04 pm
Hi, your plugin sounds fantastic and would like to use it. My question is, I want to use your plugin as part of the page or post content. What I really just want is to have my coppermine thumbnail albums show up as part of a wordpress page. Can your widget/plugin do this?
June 3rd, 2009 at 8:37 am
Hi Rein,
I can extend the plug-in and add the options to do that. They sound useful.
Melanie
June 3rd, 2009 at 10:12 am
Hi Matt,
The next addition will be to support thumbnails as part of a wordpress page. I’m working on that at the moment.
Melanie
June 4th, 2009 at 4:40 pm
Hi there, thanks for the relatively fast response! I thought that it might be helpful for others to understand that they can pick up the plugin’s setup info from the config.inc.php file which is located in their coppermine’s include directory. It contains the all important database name, server, passes etc.
June 4th, 2009 at 7:20 pm
Just wanted to let you know Melanie that I got the WP plugin installed, connected to CPG and working great except… the pop up does render the intermediate size picture, I just get nothing, in IE I can see the missing image “X”. I tried digging in the .js file but don’t really know what to look for (let alone how the javascript works)… cheers and let me know if I can just disable the pop up as I don’t really need it or want it anyway.
June 5th, 2009 at 11:39 am
Hi mellanie , thanks for sharing the wrodpress plugin, there is an error on my widget saying cant choose database ? All the details I wrote to the option page later on when I return they are all gone
thanks
June 5th, 2009 at 11:50 am
Matt, what version of coppermine are you using?
Could you look in the albums/uploads directory and tell me what prefixes you see on the front of the image files please. I.e. if you have an image, my_house.jpg, the thumb nail would be thumb_my_house.jpg. Now the plug-in assumes medium sized images are named normal_my_house.jpg. However yours don’t seem to be which is why it can’t find them and display them.
I may need to add a field to allow users to enter the right prefix. I *will* add an option to disable the pop-up. I’ll do that first.
Melanie
June 5th, 2009 at 2:18 pm
Hi Justo,
Firstly what version of Wordpress and Coppermine are you using? Also when you mean options page is that the plug-in settings page where you enter the database details or the widget page? When you enter the database settings and click the button to save them do you get any errors?
Cheers
Melanie
June 5th, 2009 at 4:17 pm
I too have a similar issue to Matt. I can get the thumbs displayed on my WordPress blog but, using Firefox, the mouse over gives me a small black box. All my photos are at /webroot/coppermine/albums and I am not resizing them so they are getting any prefixes applied.
I definitely would like to be able to use the pop-up feature in on my system if it will be possible in the future.
Thanks,
Scott
June 6th, 2009 at 4:52 pm
Hi Scott.
Like Matt you do not seem to have the intermediate version of the images. I.e. the ones that have filenames starting with normal_. These are the one’s the plug in displays in the pop-up. Could you please tell me what the value of the setting on the Coppermine configuration page for “Files and thumbnails settings -> Create intermediate pictures” is. I made an assumption that everyone will have theses images. This may be turning out to be incorrect. I will ponder a solution.
Melanie
June 7th, 2009 at 6:48 am
Hi Cyberspice,
Was just letting you know that I had the same issue as ‘Genelia Online’ (Post 7).
I found the reason, in my situation the database password had non-alpha/numeric characters (e.g. ‘<’) and they were removed with ’strip_tags’ after the post (line 179, wp-cpg-plugin.php).
I know its to prevent SQL Injection, maybe an alternate sanitization method will need to be used e.g. mysql_real_escape_string?
Thanks again for the plug-in though
– Shadow
June 8th, 2009 at 8:26 pm
The version of coppermine I am using is: Coppermine Photo Gallery 1.4.22 (stable)
As far as using the intermediate pictures to show in the Wordpress popup, apparently the pictures I currently have in Coppermine are small and Coppermine did not create Intermediate photo files even though in my CPG setting I do have “create intermediate photos” set to yes…
I looked in the albums/uploads directory to verify and only the thumb_ prefix is being created. The prefix is not the issue. I can see that the popups are not displaying because coppermine did not create intermediate pics because my original picture files are pretty small already. The problem is Coppermine is too smart…
As a test, I downloaded the pictures from my coppermine sidebar album and duplicated them withe the prefix normal_ then uploaded those into the uploads directory and WP the sidebar popup works magically. Maybe this is the fix, maybe not, but the troubleshooting show you what did not work with the initial installation of your plugin.
June 8th, 2009 at 8:31 pm
The other thing that is really annoying is in IE7, the popup window does not go away. I can see that the .js file is set to make the popup disapear which works fine in Firfox 3 and Chrome but again is not working in IE7.
June 8th, 2009 at 9:43 pm
Melanie,
I am set to create intermediate size pictures and the max width is set to 1000 px. However, I normally modify every photo before I post it in my gallery and resize it to 800 or 900 px. I only set the “create intermediate” option because I have at times accidentally posted up some full size photos.
It seems silly to complain “that it doesn’t for me” since you can’t please all the people all the time. NTL, the plug-in is very cool.
Scott
June 9th, 2009 at 3:08 pm
Hey guys. Thanks for some great feedback.
I have an idea for adding a config option that allows you to use either intermediate images for pop-up or scaled (if necessary) full sized images. That way if you don’t get pop-up images you can enable the latter. I also intend to add another couple of options such as disabling the pop-up completely and so on.
As this thread is getting quite long (and I hope to be doing more development) I’ll set up some forum software for further discussions. Also, since I’m purely linux and OS X, I’ll create a couple of VMs simply to test in IE.
Melanie
June 10th, 2009 at 2:27 pm
Right the forums are now up and running and can be found at:
http://www.cyberspice.org.uk/forums/index.php
June 16th, 2009 at 12:33 am
hey i really like your plugin
plz i need your Help
can u check this page Link plz :
http://wordpress.org/support/topic/280480
i need your help if you don’t mind
you can contact me on webmaster@haifafans.net
June 21st, 2009 at 11:52 pm
The comment posted regarding config.inc.php (contains the default set up data)was extremely helpful. Many thanks! You made my evening more enjoyable!
July 2nd, 2009 at 8:15 pm
[...] Well, got around to messing with the blog again and rediscovering what it is i was doing with it long ago.. time flies.. hopefully i can get a few wrinkles out of it and back online again… Found a cool Gallery widget over on the side.. seems to work, a few initial bugs with the pop up deal but it is almost a winner… http://www.cyberspice.org.uk/blog/wordpress-coppermine-widget/ [...]
July 7th, 2009 at 8:17 am
[...] the best sources on this include Rue Plumet’s CoppermineSC plugin and Cyberspice’s WordPress Coppermine Widget. I have passed over [...]
July 7th, 2009 at 3:53 pm
Great plugin, thanks!
I don’t use intermediate files, so I edited your code to remove the “normal_”.
Two problems/suggestions:
1. The plugin does not respect the CPG group/password restrictions, and will show images from all galleries; my workaround is just to select a specific album (that I know is “public”), but ideally I’d like to be able to have it pick random photos from all of my “public” albums.
2. The popups go behind embedded youTube items that I have in WP blog entries.
July 23rd, 2009 at 12:41 pm
Pete,
I’m adding support for those who don’t use intermediates (an option and scaling). I’ll add CPG group/password restrictions.
As for the pop ups. That is unfortunately how flash and css interacts. I have a similar issue with a flash WP plug-in and my blog’s menu bar. Some people have asked for the pop ups to be in a new window. I’ll add that as an option and it should appear over the youtube items.
Mel
September 11th, 2009 at 4:32 pm
I dont know where I am suppose put the URL etc I went thru it and it had it in several places, Where am I suppose to change this st one page or all oof them.. I am VERY new but a fast learner
September 22nd, 2009 at 2:57 pm
Hi,
I am using this plugin. Can you tell me how to auto increment the view count for the images in the coppermine gallery that displayed via this plugin on wordpress?
This option would be really nice!
October 1st, 2009 at 8:59 am
Hi
Great plugin but is there a fix for IE?
October 1st, 2009 at 2:11 pm
I’m working on it
Could you tell me which version of IE you are using?
Thanks, Mel.
October 2nd, 2009 at 3:10 pm
Hi, I would really like to use this plugin – it looks very straightforward and easy once it gets installed and configured. My problem – I can’t get it configured! Can you please email me to help – the explaining would probably take a page since I am pretty technilogically challenged so email might be best. Email pngjasinski@yahoo.com
October 4th, 2009 at 6:35 am
Dear cyberspice,
Is there a way to autoincrement the viewcount of images that are displayed through this plugin, so that the “views” in the main gallery reflect this?
Because ultimately the visitors who see the full sized image through this plugin adds up to the eyeballs count an image gets.
October 10th, 2009 at 12:46 am
Hi,
this sure sounds like a great plug-in. Somehow I can’t get it to connect to my database although I’ve entered all SQL related information as found in config.inc.php.
Could you post an example for each value so that I could check where I’m forgetting something? Mostly I’m not sure about the Database Server entry.
Cheers,
Tom
October 17th, 2009 at 11:20 am
Hi !
The plugin works fine, in general.
From time to time the program refuses a photo, when this photo is in the “badge” this disables the pop up feature. (I use “most recent” to check if a pic works)
Pb doesn’t seem to be related to file size or image dimensions.
October 29th, 2009 at 9:21 pm
I have a problem:
Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in /web/htdocs/www.sminel.com/home/wp-content/plugins/wp-cpg-widget/cpg_database.php on line 158
thx
sminel
November 4th, 2009 at 9:20 pm
Hi and first of all thanks for sharing this useful plugin.
I have a question: what if I’d like to display random pictures from a CATEGORY of my coppermine gallery? Is it possible?
Thanks since now
November 5th, 2009 at 5:13 pm
Hi, have put your plugin into my test blog at the moment to see how it integrates etc.
I notice that the pictures seem to be sized at 400xXXX. Is this size determined by coppermine, wordpress or the plugin? If it is the plugin, where would I go about changing this?
Also noticed that IE6 does seem to show the photos as I expected but Firefox 3.5 does!
Many thanks
Heysoos
November 5th, 2009 at 5:37 pm
Scrub that last one…found it. It’s in coppermine itself!
November 6th, 2009 at 9:08 pm
When I tried to drag the Widget into the side bar, the screen starts popping up with
Select images…Select images…Select images…Select images…Select images…Select images…
And I can’t…thoughts?
November 20th, 2009 at 9:34 pm
[...] Wordpress Coppermine Widget [...]
December 10th, 2009 at 9:27 pm
Thanks for the plugin, have installed and works as promised.
Is it possible to link to the “gallery/displayimage.php?album=40&pos=1″ page for the image instead of to the album its from? It can be a pain for the user to find the image if you have 20 pages in one album.
I did try and modify the code however it appears the “pos” variable is generated on the fly by coppermine and not stored in the database.
Thanks
December 18th, 2009 at 11:36 pm
It would be very cool if a single sign-on feature could be added to the plug-in.
January 16th, 2010 at 8:41 pm
How to show more than one gallery images in the widget (like yours). It just shows thumbnail images from only one gallery.
Thanks
January 19th, 2010 at 12:13 am
This looks like a great plug-in. Unfortunately I don’t seem to get the path right to the gallery. Every time I enter the complete URL to my gallery (including gallery/index.php) I do get boxes for the preview pictures on my website. However, the URL and the link are incorrect as the address to the albums is added AFTER the gallery/index.php ending. So it looks something like gallery/index.php/albums/…. How can I get rid of the index.php file in between? It seems to appear each time.
January 19th, 2010 at 7:22 am
Same problem
When I tried to drag the Widget into the side bar, the screen starts popping up with
Select images…Select images…Select images…Select images…Select images…Select images…
And I can’t…thoughts?
January 21st, 2010 at 3:43 pm
Leave the index.php out of the URL. The path should be the path to the directory containing Coppermine not the index file.
January 21st, 2010 at 3:44 pm
Which version of Wordpress and PHP are you using?
January 27th, 2010 at 7:14 am
I would like to disable javascript plugin, as I do?
February 2nd, 2010 at 2:20 pm
Hello,
is it possible to use the plugin in a theme without widgets?
February 22nd, 2010 at 4:45 pm
I have the same problem as Melanie, and I did not put index.php or any other file name in the form. I’m pretty sure I did it right. I think the problem is that it doesn’t work with 2.9.2.
March 2nd, 2010 at 8:20 pm
Hi cyberspice – I hope you still check these comments…
Pete Kavanagh said that he was able to edit your code to remove the “normal_” prefix from being added to the images. Can you tell me how I can do the same? The pop-ups don’t work for me because nooe of my coppermine images have the “normal” prefix.