News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[OBSOLETE] How to Integrate Coppermine with SMF

Started by dtm.exe, July 09, 2005, 04:59:26 PM

Previous topic - Next topic

Aravot

Weird only happens when logged in, do you want to try cpg 1.4.1 (remember it is still in beta but I use it on 3 sites)

L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Aravot

before that in smf.inc.php have you changed the path
form
$path = '../smf';
to
$path = '../board';

L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


krustyop

#184
In reply to  this Post and  this One
i've just decided to add my 2 cents and combine the whole procedure to integrate Coppermine into SMF, displaying the photo gallery into the main body of the forum.

I take no credits for it, i just tought i'd add some clarification on how i did it, and some minor changes i made.
So first step: install SMF  :o (my Webhost supports it via Fantastico, so it's easy)




Second Step: Installing and Integrating Coppermine into SMF
do as said in Dan the man's Post:
Quote from: dtm.exe on July 09, 2005, 04:59:26 PM
Coppermine is an easily setup, fast, feature-rich photo gallery script with MySQL database, user management, private galleries, automatic thumbnail creation, ecard feature and a template system for easy customization to match the rest of a site.

To start, you'll need to download Coppermine.  Once downloaded, follow these instructions to properly integrate Coppermine with your SMF forum.

In /include/init.inc.php, find:
// define('UDB_INTEGRATION', 'smf');

Replace with:
define('UDB_INTEGRATION', 'smf');

In /bridge/smf.inc.php, find:
$path = '../smf';

Replace /smf with the directory you have your SMF forum installed in.  If SMF is installed in your root directory, remove smf leaving you with $path = '../';.

Once all necessary changes have been made, upload Coppermine to its own directory (examples: /coppermine, /gallery, /album).  Once uploaded, run install.php.  Make sure you install Coppermine on the same database as that of your SMF forum.  Once installed, your new Coppermine gallery will be up and ready for use :).

-Dan The Man

As said: make sure SMF and Coppermine are sharing the same DataBase, so only registered users of the forum will access the Gallery.
p.s. if you installed SMF via fantastico, you'll need to "steal" the SMF MySql database informations from the settings.php file in the forum root folder when running Coppermine setup.. look for the following:
########## Database Info ##########
$db_server = 'localhost';
$db_name = 'Something_smf1';
$db_user = 'Something_smf1';
$db_passwd = 'some password';

Do not install Coppermine from Fantastico, or it will create it's own DB!

This should have Coppermine correctly linked to SMF



If you decide to have the gallery open in a new browser window, do the following, otherwise, skip this sub-step

1-create yourself a Gallery button, name it gallery.gif, place it into the proper theme folder you are using,
ex: /SMF/Themes/default/images/english/ if you are using the defautl theme or
/SMF/Themes/ThemeName/images/english for a custom theme.

2-Edit the index.template.php file on the theme you are using with BBedit(MAC) or Notepad(PC)
look for the following lines:(at the end)

// Otherwise, they might want to [logout]...
else {
echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';


insert the following code between the "else{" and "echo '<a href="', $scripturl, '?action=logout;"(...)

(change the "../gallery" on the  first line to match the name of the coppermine folder)

   echo '<a href="../gallery" >',
    ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/gallery.gif" alt="Photo Gallery" style="margin: 2px 0;"
    border="0" />' : "Photo Gallery"),'</a>', $context['menu_separator'];

placing the code there will make the Gallery button display only when users are logged in into the forum, at the end of the button row, just before the logout button.

If you did add the above code, skip to step 4





Third Step: Make coppermine display into the forum page itself

Based on Scrawl Post as noted below, with some minor changes of my own,
original post is here:
Quote from: scrawl on August 28, 2005, 06:04:29 AM
0.5-create yourself a Gallery button, name it gallery.gif, place it into the proper theme folder you are using,
ex: /SMF/Themes/default/images/english/ if you are using the defautl theme or
/SMF/Themes/ThemeName/images/english for a custom theme.
This takes for granted that /SMF is the forum root folder

1. open /smf/index.php
2. find this line:

'boardrecount' => array('Admin.php', 'AdminBoardRecount'),
and after that code add this code:
'coppermine' => array('Coppermine.php', 'Coppermine'),

3. create a file called Coppermine.php with your text-only editor such as NotePad (PC) or BBEdit (Mac) and add this code inside it:
<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
Coppermine() {
// This is gonna be needed...
loadTemplate('Coppermine');
}
?>

4. save this file inside /smf/Sources

5. create a file called Coppermine.template.php with your text-only editor such as NotePad (PC) or BBEdit (Mac) and add this code inside it:
<?php

function template_main()
{
     global $context$settings$options$txt$scripturl;

        echo '
        <script language="JavaScript" type="text/javascript"><!--
                function checkAll(onOff)
                {
                        for (var i = 0; i < document.searchform.elements.length; i++)
                        {
                                if (document.searchform.elements[i].name.substr(0, 3) == "brd")
                                        document.searchform.elements[i].checked = onOff;
                        }
                }
        // --></script>
        <form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">
                <table width="80%" border="0" cellspacing="0" cellpadding="3" align="center">
                        <tr>
                                <td>'
theme_linktree(), '</td>
                        </tr>
                </table>

                <table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery</td>
                        </tr><tr>
                                <td class="windowbg">'
;

                                        // load coppermine
        echo '<iframe width="100%" height="450"
src="http://YourSite.com/gallery"></iframe>'
;

        echo '
                                </td>
                        </tr>
                </table>
        </form>'
;
}

?>

^^note the address in the above code change this to reflect your index.php file in your coppermine folder and make sure to leave out the www so as to keep compatability with firefox and IE,

Change i Made:
The original post adds /index.php at the end of the adress, don't put it there, since it will disable the automatic user login from the forum and makes the gallery display as unregistered user


6. save this file inside /smf/Themes/default/

7. in that same folder open /smf/Themes/default/index.template.php and at the end of the file find this bit of code:
The original post have you look for the calendar section to add the code, i'm changing it in order to have the Gallery button display only when the user is Logged-in
// Otherwise, they might want to [logout]...
else {
echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'],
    '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
    . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108]
    . '" style="margin: 2px 0;" border="0" />' : $txt[108]),'</a>';


insert the following code between the "else{" and "echo '<a href="', $scripturl, '?action=logout;"(...)//begin gallery code
                echo '
                                <a href="', $scripturl, '?action=coppermine"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gallery.gif" alt="' . "Gallery" . '" style="margin: 2px 0;" border="0" /></a>', $context['menu_separator'];
//end gallery code


This is it for this section, Phew!





Fourth Step: Preventing navigation Errors
In order to prevent coppermine Logout errors and the forum displaying in a loop insde the iframe if integrated into the forum display, we have to edit the coppermine theme file you are using.

So:
if If you have the Photo gallery open in a blank page, do the following;
Open the coppermine theme.php file you are using (ex:/gallery/theme/classic/theme.php
and replace everything that is between the
<!-- BEGIN logout -->
<!-- END logout -->
to have it look like this:
<!-- BEGIN logout -->
                                               <a href="../forum/index.php">Back to forum</a> |
<!-- END logout -->

So this will close the Coppermine page and send the user back to the forum index, using the cookie to remember the login and password of the user.


If you did include the Gallery Into the iframe of the forum:
It's better to disable the profile and logout buttons of coppermine so as the register button(since registration is handled by the forum...
to do so, Open the coppermine theme.php file you are using (ex:/gallery/theme/classic/theme.php
and clear the lines between the register, login and logout tags, so that it looks like this:
define('THEME_HAS_RATING_GRAPHICS', 1);
// HTML template for main menu
$template_main_menu1 = <<<EOT
                                                |
<!-- BEGIN my_gallery -->
                                                <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a> |
<!-- END my_gallery -->
<!-- BEGIN allow_memberlist -->
                                                <a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a> |
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
                                         
<!-- END my_profile -->
<!-- BEGIN faq -->
                        <a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a> |
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
                                                <a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}">{ADM_MODE_LNK}</a> |
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
                                                <a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}">{USR_MODE_LNK}</a> |
<!-- END leave_admin_mode -->
<!-- BEGIN upload_pic -->
                                                <a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a> |
<!-- END upload_pic -->
<!-- BEGIN register -->
                                               
<!-- END register -->
<!-- BEGIN login -->
                                             
<!-- END login -->

<!-- BEGIN logout -->
                                             
<!-- END logout -->
EOT;


i hope it helps and gathers all the infos needed in the same place..



There are some stuff i'm still wondering about:

Quote from: scrawl on August 29, 2005, 07:36:03 PM
Quote from: ruzster on August 29, 2005, 09:34:37 AM
This is awesome, scrawl. It's exactly what I was looking for. Thanks. My only question is how to make the iframe automatically resize to the page size. So that it doesn't appear to be inside a frame. Any suggestions?

not exactly following what you mean but try this, make sure both the width and height are set at 100%

// load coppermine
echo '<iframe width="100%" height="100%" src="http://yourserver.com/public_html/coppermine/index.php"></iframe>';
For me Putting 100% won't display the Iframe at all, seems i need to have a fixed pixel height,
any Ideas in this one?

then the other thing,
since it a custom added section to the Board, when looking at what users are doing in the forum, it says "Unknown action", Someone has a clue on this one?

Regards,
Dom



ADDON
If you want to prevent unregistered users to see the Gallery by typing direct url like h**p://yoursite.com/gallery, simply add the following code to the file /gallery/index.php

Look for require('include/init.inc.php');
and add this on a new line after the semicolon //Prevent Unregistered users
if (USER_ID){

} else {
{
  $redirect = $redirect . "../forum/index.php";
      header("Location: $redirect");

  exit();
}}
//end Prevent Unregistered users

This will forward all non-logged/unregistered users to the login/subscribe page of SMF

You could also give the possibility to your users to open the gallery in a new window even if integrated into the forum, easy way is to edit the coppermine.template.php file and adding a href in the title bar of the forum section, still protected by forum logins...
Changing
<table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery</td>
                        </tr><tr>
                                <td class="windowbg">';

to
<table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
                        <tr class="titlebg">
                                <td>Coppermine Photo Gallery  Open the photo gallery on a new page by clicking <a href="http://yoursite.com/gallery"target="_blank">here</a></td>
                        </tr><tr>
                                <td class="windowbg">';


i'm having fun!

Dom

scrawl

damn that would've taken ages to put together, good work. gotta say i didn't realise about that index.php i had added messing with the logins cheers for pointing that out.

krustyop

There is 2 things i'm still wondering about:

1-about iframe dynamic resizing
Quote from: scrawl on August 29, 2005, 07:36:03 PM
Quote from: ruzster on August 29, 2005, 09:34:37 AM
This is awesome, scrawl. It's exactly what I was looking for. Thanks. My only question is how to make the iframe automatically resize to the page size. So that it doesn't appear to be inside a frame. Any suggestions?

not exactly following what you mean but try this, make sure both the width and height are set at 100%

// load coppermine
echo '<iframe width="100%" height="100%" src="http://yourserver.com/public_html/coppermine/index.php"></iframe>';
For me Putting 100% won't display the Iframe at all, seems i need to have a fixed pixel height,
any Ideas in this one?

2- then the other thing,
since it a custom added section to the Board, when looking at what users are doing in the forum, it says "Unknown action", Someone has a clue on this one?

Regards,
Dom

SpectroPro

Ok..I have read all I could on this subject.  I have followed the instructions to the letter as far as I can tell.  Changed the 2 files  in 1.3.3, ran the installer, and when it goes to continue to the site, I get this error:

Fatal error: Call to undefined function: cache_get_data() in /home/spectro/public_html/fsduniverse/gallery/bridge/smf.inc.php(127) : eval()'d code on line 10

I can't figure out what I am doing wrong.  If anyone could help, I would be greatly appreciate it.  I can give someone access to the backends if needed...

Thanks!

- Greg
Stats:  SMF v. 2b4  -  Mambo v4.65  -  Bridge v2.0b1

http://www.therealityrocks.com    http://forum.therealityrocks.com/trr
- Greg

Elegant John

I've done it all to and consistently get error after error. I am trashing the CPG install and putting content within the forum itself with restricted permissions.

Perhaps in the future, SMF will have a gallery intergrated into the core which would be an awesome thing.

At this point, my biggest problem is causing the attachents to be displayed horizontal across the page instead of vertically

Majik™

#189
Quote from: SpectroPro on October 30, 2005, 11:30:30 PM
Ok..I have read all I could on this subject.  I have followed the instructions to the letter as far as I can tell.  Changed the 2 files  in 1.3.3, ran the installer, and when it goes to continue to the site, I get this error:

Fatal error: Call to undefined function: cache_get_data() in /home/spectro/public_html/fsduniverse/gallery/bridge/smf.inc.php(127) : eval()'d code on line 10

I can't figure out what I am doing wrong.  If anyone could help, I would be greatly appreciate it.  I can give someone access to the backends if needed...

Thanks!

- Greg

I'm getting the same error message..

Fatal error: Call to undefined function: cache_get_data() in /path/to/gallery/bridge/smf.inc.php(128) : eval()'d code on line 10

I copied the funciton from the "Load.php" file in the SMF source folder and pasted it into the SMF bridge file.  The gallery now loads.
hxxp:msn.majiks.ca [nonactive]

krustyop

#190
That is Because you are using SMF version 1.1, I forgot to mention that the how-to was for Smf 1.0.5

To correct this error you do as Nibbler says on This Post:


in the bridge file:
find
cm_include_smf_funcs("$sourcedir/Load.php", array("reloadSettings", "md5_hmac", "loadUserSettings"));


and change it to
cm_include_smf_funcs("$sourcedir/Load.php", array("cache_get_data", "reloadSettings", "md5_hmac", "loadUserSettings"));

dimensionmedia

Hey guys, quick question - I've got SMF 1.1 RC. Is that what you guys are talking about when you mention "SMF 1.1"? Do I follow dan's oringial instructions and just make the change Nibbler/krustyop just mentioned? I'm an idiot and looking for a more or less step-by-step here.

Oh, and if anyone has got coppermine working w/ 1.1 RC then please let me know what version of coppermine you are using (the stable one or the beta as of this writing).

Thanks!

Majik™

#192
Quote from: dimensionmedia on November 06, 2005, 05:25:42 PM
Hey guys, quick question - I've got SMF 1.1 RC. Is that what you guys are talking about when you mention "SMF 1.1"? Do I follow dan's oringial instructions and just make the change Nibbler/krustyop just mentioned? I'm an idiot and looking for a more or less step-by-step here.

Oh, and if anyone has got coppermine working w/ 1.1 RC then please let me know what version of coppermine you are using (the stable one or the beta as of this writing).

Thanks!

I've integrated Coppermine with SMF 1.1 RC using the stable release of CM.  I made the changes as outlined in this post and then added the missing function as Nibbler said to do hxxp:coppermine-gallery.net/forum/index.php?topic=22015.msg100774#msg100774 [nonactive] as suggested by krustyop.  It seems to be working fine.
hxxp:msn.majiks.ca [nonactive]

dimensionmedia


ivo2296

#194
1. I hope i did all but:

-  i don't see link to gallery.gif between main buttons
-  when i try http://*****.com/f/index.php?action=coppermine i get error:  Unable to load the 'Coppermine' template.
Here i used the same username and database but the prefix
Any idea?

I'm using SMF 1.0.5 and CPG 1.3.5

2. Then i tried with new installation of smf 1.0.5 and when i try to install CPG with the same user, database and prefix it shows that:

mySQL Error: Table 'smf_categories' already existson query ' CREATE TABLE smf_categories ( cid int(11) NOT NULL auto_increment, owner_id int(11) NOT NULL default '0', name varchar(255) NOT NULL default '', description text NOT NULL, pos int(11) NOT NULL default '0', parent int(11) NOT NULL default '0', thumb int(11) NOT NULL default '0', subcat_count int(11) NOT NULL default '0', alb_count int(11) NOT NULL default '0', pic_count int(11) NOT NULL default '0', stat_uptodate enum('YES','NO') NOT NULL default 'NO', PRIMARY KEY (cid), KEY cat_parent (parent), KEY cat_pos (pos), KEY cat_owner_id (owner_id) ) TYPE=MyISAM'


So, shall use same table prefix or not and if YES how to avoid the erros?


Thank you!

ivo2296

I have done the intergration but when i login in the forum as Admin and then i click on gallery i don't see the admin part of CPG?

John Paul

I'm attempting the integration with smf 1.1rc1 and cpg 1.4.2. in the /include/init.inc.php it's written like this:

define('UDB_INTEGRATION', $BRIDGE['short_name']);

do I need to replace [short name] with anything?

Now, I've done the seperate installs and included cpg in the smf db.  I also ran the integration wizard, but bein smf1.1 I don't know if it worked correctly.  I'm carrying on assuming I can use these instructions.  It's on a test site so I'm not worried about anything...

thanks
John Paul

kegobeer

Use Coppermine's bridge manager wizard to bridge SMF and Coppermine.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

John Paul

Quote from: kegobeer on November 28, 2005, 10:22:28 AM
Use Coppermine's bridge manager wizard to bridge SMF and Coppermine.

That's what I did. seems like it's working, but I ain't quite done. I'll report back later with the results.  Thanks!
John Paul

TANDIONO.COM

How can i integrate Coppermine 1.4.2 with SMF 1.0.5 ? Thx

Advertisement: