psnGallery 2 Sticky information

What’s that ?

It provides you an “gateway” between your Coppermine Gallery and your WordPress Blog.

A lot of functionnalities for your Blog within a post or outside a post !

How to make it work ?

The main requirements are to have installed :

If those applications are up and running, only few steps are required :

If it is a brand new installation :

To create the table, use phpMyAdmin and paste this :

CREATE TABLE `wp_psnGallery` (
`ID` int(11) NOT NULL auto_increment,
`kind` varchar(10) NOT NULL default '',
`key` varchar(64) NOT NULL default '',
`value` text NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `kind` (`kind`,`key`)
) TYPE=MyISAM COMMENT='WP psnGallery2 Tags configuration' AUTO_INCREMENT=105 ;

Once you have set the correct values to the “DBSERVER”, “DBUSER”, “DBPASS”,
“DBNAME” and “TBLPREFIX”, same as above….paste this in phpMyAdmin :

INSERT INTO `wp_psnGallery` VALUES
( 1, 'CONFIG', 'DBSERVER', 'localhost'),
( 2, 'CONFIG', 'DBUSER', 'username'),
( 3, 'CONFIG', 'DBPASS', 'password'),
( 4, 'CONFIG', 'DBNAME', 'database'),
( 5, 'CONFIG', 'TBLPREFIX', 'cpg130_'),
( 6, 'CONFIG', 'DEBUGFLAG', '0'),
( 7, 'CONFIG', 'MAXPICT', '200'),
( 8, 'CONFIG', 'EXIF', '0'),
( 9, 'CONFIG', 'CPG_TAG_PREFIX', 'cpg_'),
(10, 'CONFIG', 'TABLE_PICTURES', 'pictures'),
(11, 'CONFIG', 'TABLE_ALBUMS', 'albums'),
(12, 'CONFIG', 'TABLE_COMMENTS', 'comments'),
(13, 'CONFIG', 'TABLE_CATEGORIES', 'categories'),
(14, 'CONFIG', 'TABLE_CONFIG', 'config'),
(15, 'CONFIG', 'TABLE_USERGROUPS', 'usergroups'),
(16, 'CONFIG', 'TABLE_VOTES', 'votes'),
(17, 'CONFIG', 'TABLE_USERS', 'users'),
(20, 'TAG', 'gallery', 'CPGRndPicture($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);'),
(21, 'TAG', 'album', 'CPGAlbum($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);'),
(22, 'TAG', 'albumthumb', 'CPGAlbumThumb($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]); '),
(23, 'TAG', 'albumname', 'CPGAlbumName($elems[0]) ;'),
(24, 'TAG', 'categoryname', 'CPGCategoryName($elems[0]) ;'),
(25, 'TAG', 'albumpiccount', 'CPGAlbumPicCount($elems[0]);'),
(26, 'TAG', 'albumcatlist', 'CPGAlbumListCategory($elems[0], $elems[1], $elems[2], $elems[3], $elems[4]) '),
(27, 'TAG', 'picture', 'CPGPicture($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);'),
(30, 'MIME', 'IMAGE', '1'),
(31, 'MIME', 'MOVIE', '1'),
(32, 'MIME', 'AUDIO', '1'),
(33, 'MIME', 'DOCUMENT', '1'),
(40, 'IMAGE', 'jpg', 'image/jpg'),
(41, 'IMAGE', 'gif', 'image/gif'),
(42, 'IMAGE', 'png', 'image/png'),
(43, 'IMAGE', 'psd', 'image/psd'),
(44, 'IMAGE', 'bmp', 'image/bmp'),
(45, 'IMAGE', 'tiff', 'image/tiff'),
(46, 'IMAGE', 'tif', 'image/tif'),
(47, 'IMAGE', 'jpc', 'image/jpc'),
(48, 'IMAGE', 'jp2', 'image/jp2'),
(49, 'IMAGE', 'jpx', 'image/jpx'),
(50, 'IMAGE', 'jb2', 'image/jb2'),
(51, 'IMAGE', 'swc', 'image/swc'),
(52, 'IMAGE', 'iff', 'image/iff'),
(53, 'MOVIE', 'asf', 'video/x-ms-asf'),
(54, 'MOVIE', 'asx', 'video/x-ms-asf'),
(55, 'MOVIE', 'mpg', 'video/mpeg'),
(56, 'MOVIE', 'mpeg', 'video/mpeg'),
(57, 'MOVIE', 'wmv', 'video/x-ms-wmv'),
(58, 'MOVIE', 'swf', 'application/x-shockwave-flash'),
(59, 'MOVIE', 'avi', 'video/avi'),
(60, 'MOVIE', 'mov', 'video/quicktime'),
(61, 'AUDIO', 'ram', 'audio/x-pn-realaudio'),
(62, 'AUDIO', 'ra', 'audio/x-realaudio'),
(63, 'AUDIO', 'mp3', 'audio/mpeg3'),
(64, 'AUDIO', 'midi', 'audio/midi'),
(65, 'AUDIO', 'mid', 'audio/midi'),
(66, 'AUDIO', 'wma', 'audio/x-ms-wma'),
(67, 'AUDIO', 'wav', 'audio/wav'),
(68, 'AUDIO', 'ogg', 'audio/ogg'),
(69, 'DOCUMENT', 'doc', 'application/msword'),
(70, 'DOCUMENT', 'htm', 'text/html'),
(71, 'DOCUMENT', 'html', 'text/html'),
(72, 'DOCUMENT', 'txt', 'text/plain'),
(73, 'DOCUMENT', 'rtf', 'text/richtext'),
(74, 'DOCUMENT', 'pdf', 'application/pdf'),
(75, 'DOCUMENT', 'xls', 'application/excel'),
(76, 'DOCUMENT', 'ppt', 'application/powerpoint'),
(77, 'DOCUMENT', 'zip', 'application/zip'),
(78, 'DOCUMENT', 'rar', 'application/rar'),
(79, 'DOCUMENT', 'gz', 'application/gz'),
(80, 'DOCUMENT', 'mdb', 'application/msaccess');

If it is an upgrade from psnGallery2 version 1.2.x :

Execute the following SQL queries in phpMyAdmin :

ALTER TABLE `wp_psnGallery` CHANGE `kind` `kind` VARCHAR( 10 ) NOT NULL
INSERT INTO `wp_psnGallery` VALUES
(30, 'MIME', 'IMAGE', '1'),
(31, 'MIME', 'MOVIE', '1'),
(32, 'MIME', 'AUDIO', '1'),
(33, 'MIME', 'DOCUMENT', '1'),
(40, 'IMAGE', 'jpg', 'image/jpg'),
(41, 'IMAGE', 'gif', 'image/gif'),
(42, 'IMAGE', 'png', 'image/png'),
(43, 'IMAGE', 'psd', 'image/psd'),
(44, 'IMAGE', 'bmp', 'image/bmp'),
(45, 'IMAGE', 'tiff', 'image/tiff'),
(46, 'IMAGE', 'tif', 'image/tif'),
(47, 'IMAGE', 'jpc', 'image/jpc'),
(48, 'IMAGE', 'jp2', 'image/jp2'),
(49, 'IMAGE', 'jpx', 'image/jpx'),
(50, 'IMAGE', 'jb2', 'image/jb2'),
(51, 'IMAGE', 'swc', 'image/swc'),
(52, 'IMAGE', 'iff', 'image/iff'),
(53, 'MOVIE', 'asf', 'video/x-ms-asf'),
(54, 'MOVIE', 'asx', 'video/x-ms-asf'),
(55, 'MOVIE', 'mpg', 'video/mpeg'),
(56, 'MOVIE', 'mpeg', 'video/mpeg'),
(57, 'MOVIE', 'wmv', 'video/x-ms-wmv'),
(58, 'MOVIE', 'swf', 'application/x-shockwave-flash'),
(59, 'MOVIE', 'avi', 'video/avi'),
(60, 'MOVIE', 'mov', 'video/quicktime'),
(61, 'AUDIO', 'ram', 'audio/x-pn-realaudio'),
(62, 'AUDIO', 'ra', 'audio/x-realaudio'),
(63, 'AUDIO', 'mp3', 'audio/mpeg3'),
(64, 'AUDIO', 'midi', 'audio/midi'),
(65, 'AUDIO', 'mid', 'audio/midi'),
(66, 'AUDIO', 'wma', 'audio/x-ms-wma'),
(67, 'AUDIO', 'wav', 'audio/wav'),
(68, 'AUDIO', 'ogg', 'audio/ogg'),
(69, 'DOCUMENT', 'doc', 'application/msword'),
(70, 'DOCUMENT', 'htm', 'text/html'),
(71, 'DOCUMENT', 'html', 'text/html'),
(72, 'DOCUMENT', 'txt', 'text/plain'),
(73, 'DOCUMENT', 'rtf', 'text/richtext'),
(74, 'DOCUMENT', 'pdf', 'application/pdf'),
(75, 'DOCUMENT', 'xls', 'application/excel'),
(76, 'DOCUMENT', 'ppt', 'application/powerpoint'),
(77, 'DOCUMENT', 'zip', 'application/zip'),
(78, 'DOCUMENT', 'rar', 'application/rar'),
(79, 'DOCUMENT', 'gz', 'application/gz'),
(80, 'DOCUMENT', 'mdb', 'application/msaccess');

The following steps have to be performed in both cases :

Upload the file “psnGallery2.php” in the wp-content/plugins directory
Upload the file “psnCPGAdmin.php” in the wp-admin directory

If it is a brand new installation, you still need to add an option in the wp-admin menu, to do so :

Open “menu.php” in your wp-admin folder and find this line:

array(__(‘Categories’), 3, ‘categories.php’),

Add this line right after that:

array(__(‘psnGallery2’), 3, ‘psnCPGAdmin.php’),

USAGE :

1. FUNCTIONS LIST (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=’<li>’,$after=’</li>’, $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='<li>’, $afterCol='</li>’, $beforeRow='<ul>’, $afterRow='</ul>’)

// 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='<li>’, $after='</li>’, $mode=’picture’, $dummy=0)

// Display the specific thumbnail associated with an album
function CPGAlbumThumb ($aid, $nSize=1, $before=”, $after=”)
2. TAGS LIST (within a post)

<cpg_album> => CPGAlbum();
<cpg_albumcatlist> => CPGAlbumListCategory();
<cpg_albumname> => CPGAlbumName() ;
<cpg_albumpiccount> => CPGAlbumPicCount();
<cpg_albumthumb> => CPGAlbumThumb();
<cpg_categoryname> => CPGCategoryName() ;
<cpg_gallery> => CPGRndPicture();
<cpg_picture> => CPGPicture();
<gallery> => CPGRndPicture();


4 Replies to “psnGallery 2 Sticky information”

  1. admin

    Can you be a little bit more explicit ? Do you have a sample somewhere ? can you send me your configuration parameters (for Coppermine and for psnGallery) in other words : a dump of psngallery table and a copy of your config.inc.php from coppermine at admin at idahocline dot info ?

  2. Scott

    I seem to be having the same issue. I’m getting:
    CPGAlbum($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);
    In the Associated “function” in the “Tags available during posting” area.
    Everything seems to be working for the most part. Thumbnails show up in the picture viewer, but I’m not getting any albums showing up in the album viewer. It’s just showing the heading and not any albums below it like your image here:
    Any help would be appreciated… thanks!

  3. admin

    Thanks, Gaetan, for your help but I think I can translate in French my plugin as French is my first language….

    🙂

  4. Gaetan

    Hi
    I just discovered your program and it seems very good.
    But i can manage to get it working…
    I have the plugin installed, and all seems to work but:
    – when i try to add 4|5 to display 5 random picture from the 4th gallery, it display all the pictures…
    – the tag dont seens to work (“Nothing to display”). And the need to know the picture id is not very practical…
    – also in the main page, the “Associated function” column is filed with
    CPGAlbum($elems[0], $elems[1], $elems[2], $elems[3], $elems[4], $elems[5], $elems[6]);
    CPGAlbumListCategory($elems[0], $elems[1], $elems[2], $elems[3], $elems[4]);
    ..
    not very explicit !
    – Do you plan writing a picture picker to easily insert a picture within a new post?

    anyway thanks for this good plugin !

    PS: i can help you if you need help, i’m very interested to have a very good “gateway” between my galleries and my blog. I know a few php and can translate your work in french !

Comments are closed.

%d bloggers like this: