PDA

View Full Version : Coppermine Random Photos on vBulletin FORUMHOME (easy)


AcidX
08-18-2006, 10:00 PM
This is basicaly the easiest way to have random photos from your Coppermine Gallery displayed on your vBulletin home page.
Tested and working perfectly. Here's the installation process containing only 3 steps.

Requirements : Coppermine Photo Gallery Installed.



Installation steps :

1. Download coppermine.php and edit the database info. After you're done, upload it in your forum root.


2. Open your vBulletin index.php file and under require_once('./global.php'); add the following line:
require_once('coppermine.php');
(save the changes > upload the file in the forum root)


3. Open your Style Manager ("Styles & Templates" in the AdminCP menu) and edit the FORUMHOME template.
Depending on where you want your random pictures to appear, you should paste this code eather under $navbar or <!-- end what's going on box -->.
The code you need to paste is:

<!-- / COPPERMINE GALLERY -->
<br>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class='tcat' colspan='0' align=left>
<span class='smallfont'>
<strong>&raquo; <a href='$coppath'>Gallery</a>
</strong></span></td>
</tr>

<tr>
<td class='alt1' width='100%' align-middle valign=middle>

$copphotos
</td></tr></table>
<!-- / COPPERMINE GALLERY -->

(Save the template.)



All done.
I know you like it - https://vborg.vbsupport.ru/ (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=124398) ;)

Here's the live demo (http://forum.kajgana.com/) and some screenshots:

hgb
08-19-2006, 06:29 PM
my logo is just like here....top and to the left.... how would i put the pics to the right of the logo and and will it work with 3.6 ?

thx

Selene
08-19-2006, 09:14 PM
Hi,

great hack. Installed!

and yes it works fully with 3.6.0 as im running it there.

Just a question, what if i want to display those random pics code under forumnav, but on ALL FORUMS not just FORUMHOME, then which template should i modify

Selene
08-19-2006, 09:33 PM
another question:

what if i want to open the thumbnail pics in a "new" window ? which lines do i modify in coppermine.php for that

Barakat
08-20-2006, 03:53 AM
works great ............. thanks a lot for that love it ...

DjTaz
08-20-2006, 11:40 AM
Hi,

great hack. Installed!

and yes it works fully with 3.6.0 as im running it there.

Just a question, what if i want to display those random pics code under forumnav, but on ALL FORUMS not just FORUMHOME, then which template should i modify

If you want this hack to work on all the areas , just put the code into NAVBAR instead of FORUMHOME at the very bottom - that should do the trick for you.

:D

AcidX
08-20-2006, 11:53 AM
another question:

what if i want to open the thumbnail pics in a "new" window ? which lines do i modify in coppermine.php for that
Thanks for installing.
If you want to open the pics in a new window, just open the coppermine.php file, find the line:
$copphotos.='<td><a target = "_parent"

and replace it with:
$copphotos.='<td><a target = "_blank"

That should do the trick ;)

DjTaz
08-20-2006, 12:11 PM
OOPS - I MAY HAVE MISREAD THE QUESTION HERE - I THOUGHT YOU WANTED TO OPEN THE THUMBNAILS INSTEAD OF THE PHOTO , SORRY ... WELL THIS IS HOW THAT IS DONE ANYWAY :sanother question:

what if i want to open the thumbnail pics in a "new" window ? which lines do i modify in coppermine.php for that


Im not sure why you would want to do this , and i checked the codes on it - the amount of recoding would be huge if you wanted to make the thumbnail display instead of the image since coppermine isnt even set up to show a single thumbnail on its own.

That being said ... if you change some of the code in coppermine.php from this :
Find

$copphotos.='<td><a target = "_parent" href="' . $coppath . '/displayimage.php?album=' . $albumid .
'&pos=-' . $pos . '"><IMG SRC="' . $coppath . '/albums/' . $MZrow['filepath'].thumb_.$MZrow['filename'] .'" alt=' . $MZrow['filename'] . ' '. 'border=0
height=60>' . '</a><b><br><font size=1>Uploader:</b><br><a href="member.php?u=' . $MZrow['owner_id'] . '"> ' . $MZrow['owner_name'] . '</a><br><font size=1> ' .$ctime. ' </td>';
}


and change to


$copphotos.='<td><a target = "_parent" href="' . $coppath . '/thumbnails.php?album=' . $albumid .'"><IMG SRC="' . $coppath . '/albums/' . $MZrow['filepath'].thumb_.$MZrow['filename'] .'" alt=' . $MZrow['filename'] . ' '. 'border=0
height=60>' . '</a><b><br><font size=1>Uploader:</b><br><a href="member.php?u=' . $MZrow['owner_id'] . '"> ' . $MZrow['owner_name'] . '</a><br><font size=1> ' .$ctime. ' </td>';
}


it should bring you to that users thumbnail page instead of to the photo itself

AcidX
08-21-2006, 02:18 PM
Indeed.
You got two resonable answers and modifications - I hope you got what you were asking for ;)

Konstantinos
09-27-2006, 03:50 PM
why the thumbnails in forum home are much smaller than the thumbs in coppermine home and how to fix this ?

Konstantinos
10-01-2006, 06:28 PM
i found a bug. it displays thumbs for uploaded pics that ARENT approved yet by the admin. any fix ?

AcidX
11-14-2006, 09:44 PM
i found a bug. it displays thumbs for uploaded pics that ARENT approved yet by the admin. any fix ?Are you sure about this?

DjTaz
11-14-2006, 11:21 PM
Yes they are sure - the coppermine.php script isnt set to check for approvals , it just randomly checks all the files. Luckily i have a fix for that if you wish

change the code in coppermine.php line 27 from

$MZresult = @mysql_query("SELECT * FROM ".$prefix."_pictures ORDER BY RAND() LIMIT 0,$amount");


to


$MZresult = @mysql_query("SELECT * FROM ".$prefix."_pictures WHERE approved='YES' ORDER BY RAND() LIMIT 0,$amount");


and your in business again with only approved photos showing.

Anyone with VBadvanced , you can get the module for it here : https://vborg.vbsupport.ru/showthread.php?t=119432

AcidX
11-15-2006, 10:04 AM
Bug fixed. Thanks Tazie! ;)

I replaced the coppermine.php file. Everyone that installed this mod can download the new version now.

Martin-TMGRS
11-17-2006, 12:17 PM
Does anyone know how to port this for VB3.6.3 ?? I've tried to put this on my forum and get this error.

Table 'db149830456.thread' doesn't exist
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /index.php(64) : eval()'d code on line 746

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/46/d101530151/htdocs/mkportal/include/VB/vb_out.php on line 42

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/46/d101530151/htdocs/mkportal/include/mk_mySQL.php on line 57

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/46/d101530151/htdocs/mkportal/include/mk_mySQL.php on line 57

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/46/d101530151/htdocs/mkportal/include/mk_mySQL.php on line 57

Any ideas please and thanks in advance

DjTaz
01-20-2007, 11:00 PM
Martin - only spotted this now - where exactly did you put this , and where does that error appear ? Is coppermine running ok on its own ?

A little more info is required to get this going please...

Xbizcafe
01-30-2007, 03:21 PM
why the thumbnails in forum home are much smaller than the thumbs in coppermine home and how to fix this ?

I have same question. Who can help us ?

DjTaz
01-30-2007, 08:37 PM
I have same question. Who can help us ?



in the line that says

$copphotos.='<td><a target = "_parent" href="' . $coppath . '/displayimage.php?album=' . $albumid .
'&pos=-' . $pos . '"><IMG SRC="' . $coppath . '/albums/' . $MZrow['filepath'].thumb_.$MZrow['filename'] .'" alt=' . $MZrow['filename'] . ' '. 'border=0
height=60>' . '</a><b><br><font size=1>Uploader:</b><br><a href="member.php?u=' . $MZrow['owner_id'] . '"> ' . $MZrow['owner_name'] . '</a><br><font size=1> ' .$ctime. ' </td>';
}


of coppermine.php change the height=60 to the height you want- you get bigger or smaller

Soliloquy
02-02-2007, 05:30 AM
I've installed this (thanks!) and it runs fine, but I'd love to get it to display in the left hand column (https://vborg.vbsupport.ru/showthread.php?t=117988). Any chance of that?

DjTaz
02-02-2007, 03:33 PM
just paste the code into the right hand column tempate instead of forumhome and do the rest the same.

You want a <br> in somewhere to drop it down a line each time , but i dont have that hack so im not sure

Soliloquy
02-02-2007, 04:21 PM
I tried that DjTaz, it just won't load. Worked fine in forumhome though.

tandy
03-20-2007, 12:55 PM
Is it possible to display the user pictures instead of random pictures

DjTaz
03-20-2007, 04:03 PM
Yes , its possible to display just the users gallery if you want that - i have that done in the members profiles when you go to a members profile page near the bottom.

http://www.theotherzone.com/member.php?u=1 is something like what you want ??

Or do you want a that persons gallery to display on the page when they enter ? The problem i see with that is no one gets to see anyone elses gallery, which defeats the purpose of it

tandy
03-20-2007, 06:58 PM
Yes , its possible to display just the users gallery if you want that - i have that done in the members profiles when you go to a members profile page near the bottom.

http://www.theotherzone.com/member.php?u=1 is something like what you want ??
That's exactly what i need.

Or do you want a that persons gallery to display on the page when they enter ? The problem i see with that is no one gets to see anyone elses gallery, which defeats the purpose of it

This one i do it and we can see the others gallery too.

Hengest
07-06-2007, 02:02 PM
Hi, thanks for this mod, but I am having a problem.

I have edited the coppermine.php file with the following and uploaded to forum root. My coppermine folder is called photoalbum and is in the ame location as my forum folder.


$coppath = "/photoalbum/"; // Path to the gallery from the coppermine.php file
$hostname = "localhost"; // The Coppermine hostname - usually localhost
$username = "dbo1*******"; // Coopermine Database Username
$copperpass= "B*******"; // Password to the Coppermine Database
$copperdb= "db1*******"; // Coppermine Database
$prefix= "cpg148"; // Coppermine Prefix (sometimes cpg133 , or cpg11d)
$amount= "6"; // Amount of photos to select


I have edited and uploaded the index.php file as follows:

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('coppermine.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/functions_forumlist.php');

And finally I copied and pasted the code provided into the forumhome template just below $navbar.

When I try to return to my forum I get a blank page with the message "Unable to connect to the database server at this time."

I am assuming that this is because there is an error with either the hostname, db login or db password. I copied and pasted the login and password directly from the MySQL admin panel provided by my host so I am assuming the problem is with hostname.

Any suggestions would be appreciated please.

DjTaz
07-08-2007, 09:08 PM
is the prefix correct ?

Hengest
07-09-2007, 07:27 PM
Hmm, well I changed it and now at least I can get into the forum with no error message and I see the table below the navbar with "Gallery" in the top left corner but no images appear.

Thanks

DjTaz
03-17-2008, 08:59 PM
You still looking to port this to 3.6.3 or have you moved up a level since ? Im only going back over the old threads now :S

andres28
11-02-2008, 03:51 AM
Hi,

im not really good at coding.. but I want all my random pictures to display on a Ajax page
can you please help me modify this code.

Original


echo('<a target = "_new" href="' . $copperminepath . '/displayimage.php?album=' . $albumid .
'&pos=-' . $pos . '">');


and I need to integrate this code into the one on top.


<a href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'ajax', 'picture-path.htm', 'Ajax Win Title', 'width=650px,height=400px,left=300px,top=100px,res ize=0,scrolling=1'); return false">



Thank you.
Andres Carvajal
http://www.simplementetodo.com

BAJR
01-26-2010, 03:15 PM
Has anyone updated this for 4.0 at all :)

BAJR
01-28-2010, 05:01 PM
I am taking it this is a no.. :)
I don't get the changes... and not being at all php literate... I am out of my comfort zone