Further information on psnGallery2 tags/functions

Out of a post (eg: in index.php)

// Generate tags to display several random pictures from a specific Coppermine album (if -1 : from all albums)
function CPGRndPicture($aid=-1, $count =-1, $nSize=1,$before='',$after='', $activelink=true, $dummy='') // Generate tags to display a full album from a specific Coppermine album (if -1 : from all albums)...
function CPGAlbum($aid, $nCols=4, $nSize=1, $beforeCol="", $afterCol="", $beforeRow="", $afterRow="")

// Get the name of an album
function CPGAlbumName($aid)

// Get the name of a category
function CPGCategoryName($cid)

// Get the number of pictures within an album
function CPGAlbumPicCount($aid)

// Get the album name list of a category
function CPGAlbumListCategory($cid, $count=-1, $nSize=1, $before='', $after='')

// Display a picture (in some modes)
function CPGPicture($pictID, $nSize=1, $before='', $after='', $mode='picture', $dummy=0)

// Display the specific thumbnail associated with an album
function CPGAlbumThumb ($aid, $nSize=1, $before='', $after='')

Within POST

Tag defined Associated function Action

  • <cpg_album> => CPGAlbum($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]);
  • <cpg_albumcatlist> => CPGAlbumListCategory($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ]);
  • <cpg_albumname> => CPGAlbumName($elems[ 0 ]) ;
  • <cpg_albumpiccount> => CPGAlbumPicCount($elems[ 0 ]);
  • <cpg_albumthumb> => CPGAlbumThumb($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]);
  • <cpg_categoryname> => CPGCategoryName($elems[ 0 ]) ;
  • <cpg_gallery> => CPGRndPicture($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]);
  • <cpg_picture> => CPGPicture($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]);
  • <gallery> => CPGRndPicture($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]);

Of course, $elems[ x ] will be replace by the according value:

In other words : <cpg_gallery>1|5|1</cpg_gallery> will become CPGRndPicture(1, 5, 1, ”, ”, ”, ”); and finally :

Another example : <cpg_picture>275|1</cpg_picture> will become CPGPicture(275, 1, ”, ”, ”, ”, ”) and finally :

19 thoughts on “Further information on psnGallery2 tags/functions”

  1. I’m sorry, i just don’t understand how to use the tags, i have it figured out how to post X amt of random pictures from a certain gallery, but other than that, i don’t have any idea… i think i just don’t think in the ways you described how the tags work… can anyone help me better understand? the whole ($elems[ 0 ], $elems[ 1 ], $elems[ 2 ], $elems[ 3 ], $elems[ 4 ], $elems[ 5 ], $elems[ 6 ]) thing just confuses me!

  2. I saw that you were able to display the symbol “< " in your comment, can you tell me how you do that ? In my blog, when I type "<" or ">“, they are interpreted as PHP codes. But I want to make
    them appear as text. Can you enlighten me on this ?

  3. You get the “picture id” via the Administration page (within the url). In the coming release, as you can see on this site, the “picture id” is displayed once you put your mouse over the picture (title of the image).

  4. Hi, your software is indeed very interesting, I have got it to work on my blog. The only
    problem that I have trouble understanding is how do we know what is the picture number in the
    Coppermine Gallery ? In fact, since all the album are only has a “album name”, how do we know
    what is the “album number ” ? Can you kindly help me here ?

    Thank you.
    Kung C L

  5. okay ! I saw your site.
    The easiest way is to show a sample :
    < ?php CPGRndPicture(-1, 4, 1,'

  6. ',''); ?>

  7. hey! actually, both of my issues are fixed with version 1.22 – honestly. if you lived closer to me, I’d buy you a beer ๐Ÿ™‚

  8. Dear Pascal,

    seemed to be a problem on my side. Issue 1 (wrong path) got fixed with 1.2.2.; Issue 2 is a problem on my server. I installed CP on another server, and voil

  9. Joel: issue 1 : can you provide me a dump of your wp_psnGallery table ?
    issue 2 is fixed with version 1.2.2
    Markus : issue 1 : can you provide me the same dump ? (of both servers) But if the “coppermine” dbserver is located on another server, the dbserver must be a “reachable” servername (something else than localhost)..this is rare…
    issue 2 : same answer…

  10. Hey! The psnGallery for WP is excellent. I do have a couple issues – hopefully you can help me out with them.

    Issue 1 – While in the psnAdmin page, under “Coppermine Picture Viewer”, it says “Album -1: no pictures found”. I have ~4500 pictures in my gallery, so it should find something.

    Issue 2 – clicking on a thumbnail image brings me to a file not found (404) error. it looks like it’s trying to link to the Coppermine “displayimage.php” file in the current directory. WordPress is installed in /wp and Coppermine is in /gallery. I know I could go in and probably fix it, but if you already know of where to fix it, that would be cool.


  11. Hi Pascal,

    first of all, thank you for your great work, I really admire it. Though I have some problems:

    1. My blog is hosted on a different server as my Coppermine Gallery. I tried several things, even giving access form all hosts (via phpmyadmin), but I cannot access my gallery via my blog-server. Any suggestions?

    2. Finaly, I gave up and installed a wp-blog on my coppermine server. Everything works fine, I can see the thumbs in psnCPGAdmin.php, and the tumbs are even displayed in an post (using your tags). Still, the link from the thumbnail to the normal-sized image is not correct; I tried to fix this by changing the “Target address for the ‘See more pictures’ link in e-cards” in Coppermine (I read about this in the dev forum via wp.org), but it semms that this has actually no effect onto my settings.

    I would be very happy, if you could give me a hand on this – thank you very much. You can reach me via email for server deatils etc.


  12. Several friends asked me to have a look indeed to .NET but until now I have had the time. But I, as always, never close a door…. ๐Ÿ˜‰

    Thanks for your support !

  13. Hi Idaho Cline!
    Is there any chance you’ll be starting to do some serious coding in C#.NET?
    If not, don’t worry, I’ll still be a fan of yours.
    Marcel V.

  14. Just in case you need a translator for this plugin, I’m Dutch, so I could translate it for you in Dutch. I don’t know how a ‘plugin’ translation fits into the current translation interface of wordpress. Maybe you do?

  15. 1. nSize
    1 => Thumbnail
    2 => Normal

    2. Indeed you are right. The picture id will be added and the filename will be replaced with the “caption” or “title” used in Coppermine.

  16. It makes more sense now, but I still don’t know what the different modes are for the ‘CPGPicture’ function. I looked into the code and I found that the nSize is not used. Why is that?

    Furthermore 2 ideas:
    1. In the admin part it would be really handy to show the picture id. I now have to use phpMyAdmin to look for it.
    2. Don’t use the filename for the picture title, but the ‘title’ field in coppermine. It’s more readable.

Comments are closed.