forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: content syndication (cpmFetch) => Topic started by: DaMysterious on November 01, 2003, 06:11:29 pm

Title: Gallery Block for my phpBB portal
Post by: DaMysterious on November 01, 2003, 06:11:29 pm
On my phpBB (http://damysterious.xs4all.nl/) portal I like to have a CPG-Gallery Block like on my nuked (http://damysterious.xs4all.nl/nuked/) site. How to realise this. Something I tryed the last days does'nt work, also ssi.php wil not work for me when including any code from example.php into my portal.tpl. Problem seems to be the *.tpl from the phpBB templates. My phpBB and coppermine databases are locatet in different bases, I know that I have to call the CPG database first but have no idea as I'm not very good in programming php. Anyone a hint how to create/realise a new/random picblock on my phpBB frontpage?
Title: Gallery Block for my phpBB portal
Post by: Zarsky on November 02, 2003, 12:42:22 am
you could try this terribly written code I hacked up on the old board...I still use it and it works for me...

Original thread:
http://coppermine.sourceforge.net/oldboard/viewtopic.php?t=1106&highlight=random

my latest code:

Code: [Select]
<?php 

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/photo_album';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''user''passwd'); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine_database') ) {
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,1"); 
if (!
$MZresult) { 
die(
'<p>Error performing query: ' mysql_error() . 
'</p>'); 


while ( 
$MZrow mysql_fetch_array($MZresult) ) { 

$albumid $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location

echo('<P ALIGN=center>'); 

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] .
     
'" alt=' $MZrow['filename'] . ' ''border=0>' '</a>'); //outputs path from /userspics 


//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'"); 
if (!
$MZalbumresult) { 
die(
'<p>Error performing query: ' mysql_error() . 
'</p>'); 


while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) { 
//echo('<FONT SIZE=2>'); 
echo('<P ALIGN=center>'); 

echo(
'<a href="' $copperminepath 
'/thumbnails.php?album=' $albumid '">' 
$MZalbumname['title'] . '</a>' '</p>'); 


if (! @
mysql_select_db('main_website_DB') ) { 
die( 
'<p>Unable to reload the main website ' 
'database at this time.</p>' ); 


?>
Title: Gallery Block for my phpBB portal
Post by: DaMysterious on November 02, 2003, 03:17:01 pm
Quote from: "zarsky99"
you could try this terribly written code I hacked up on the old board...I still use it and it works for me...

Original thread:
http://coppermine.sourceforge.net/oldboard/viewtopic.php?t=1106&highlight=random

my latest code:



Cooooool it works. Thanks Zarsky99! Do you have any suggestion how to place the tumbs (I wil show 4-6) in a row? Now they are displayed in a culumn (http://damysterious.xs4all.nl/portal.php?s=10). Next question, how to filter out some specific groups (porn)?
Title: Gallery Block for my phpBB portal
Post by: Inertia on November 09, 2003, 07:22:46 pm
I have a really silly question - but I am struggling with this! It's exactly what I am looking for.

My forum - http://www.alucinae.com/dystopia (phpbb)

I don't use a portal, but I do have a side nav bar, where I really want to display the latest image.

I have tried ssi.php and couldn't get it to work. I thought I'd try this script, and on its own it works great. However, how do I place this script into the TPL file where my side nav is?

If you take a look at the site now - you'll see i have a section for "the galleries" - it is supposed to display the images there.

Any help would be great!
Title: Gallery Block for my phpBB portal
Post by: DaMysterious on November 09, 2003, 11:38:14 pm
Quote from: "Inertia"
I have a really silly question - but I am struggling with this! It's exactly what I am looking for.

My forum - http://www.alucinae.com/dystopia (phpbb)

I don't use a portal, but I do have a side nav bar, where I really want to display the latest image.

I have tried ssi.php and couldn't get it to work. I thought I'd try this script, and on its own it works great. However, how do I place this script into the TPL file where my side nav is?

If you take a look at the site now - you'll see i have a section for "the galleries" - it is supposed to display the images there.

Any help would be great!



Ok here we go:

In your case create a file e.g 'gallery_side_random_block.php' in you coppermine dir, put the code below in it and change the path to your '/gallery' and correct the connection to your mySql database, further you could change the number of dispayed thumbs with 'LIMIT 0,4' on row 30 to the amount you like. Now there are random 4 thumbs vertically displayed.

Code: [Select]

<?php  

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/gallery';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''root'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) {  
echo( 
'<p>Unable to connect to the ' .  
'database server at this time.</p>' );  
exit();  
}  

//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine') ) { 
die( 
'<p>Unable to locate the picture ' .  
'database at this time.</p>' );  
}  

//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,4");  
if (!
$MZresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZrow mysql_fetch_array($MZresult) ) {  

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location 

echo('<P ALIGN=center>');  

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=80 height=50>' '</a>'); //outputs path from /userspics 
}  

//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");  
if (!
$MZalbumresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {  
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>');  

echo(
'<a href="' $copperminepath .  
'/thumbnails.php?album=' $albumid '">' .  
$MZalbumname['title'] . '</a>' '</p>');  
}  

if (! @
mysql_select_db('coppermine') ) {  
die( 
'<p>Unable to reload the main website ' .  
'database at this time.</p>' );  
}  

?>



Go to your sidenav.tpl and add the code below to your table/block 'my gallery' section (change to he right path).

Code: [Select]

<?php include("/inetpub/coppermine/gallery_side_random_block.php");>


Note: Normally a php-call wil not run from any .tpl inside phpBB so you have to look for the 'eXtreme Styles mod' from Vjacheslav Trushkin (http://www.trushkin.net/phpbbmods.php)

Have success.


For other codefreaks I change the code from zarsky99 to a set of different center-blocks to use within *.tpl they all display horizontally.

1) gallery_center_newest_block.php
Code: [Select]

<?php  

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/gallery';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''root'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) {  
echo( 
'<p>Unable to connect to the ' .  
'database server at this time.</p>' );  
exit();  
}  

//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine') ) { 
die( 
'<p>Unable to locate the picture ' .  
'database at this time.</p>' );  
}  

//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY pid DESC LIMIT 0,6");  
if (!
$MZresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZrow mysql_fetch_array($MZresult) ) {  

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location 

// echo('<P ALIGN=center>');  

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=60 height=50>' '</a> &nbsp;&nbsp;'); //outputs path from /userspics 
}  

//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");  
if (!
$MZalbumresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {  
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>');  

echo(
'<a href="' $copperminepath .  
'/thumbnails.php?album=' $albumid '">' .  
$MZalbumname['title'] . '</a>' '</p>');  
}  

if (! @
mysql_select_db('coppermine') ) {  
die( 
'<p>Unable to reload the main website ' .  
'database at this time.</p>' );  
}  

?>



2) gallery_center_random_block.php
Code: [Select]

<?php  

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/gallery';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''root'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) {  
echo( 
'<p>Unable to connect to the ' .  
'database server at this time.</p>' );  
exit();  
}  

//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine') ) { 
die( 
'<p>Unable to locate the picture ' .  
'database at this time.</p>' );  
}  

//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,6");  
if (!
$MZresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZrow mysql_fetch_array($MZresult) ) {  

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location 

// echo('<P ALIGN=center>');  

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=60 height=50>' '</a> &nbsp;&nbsp;'); //outputs path from /userspics 
}  

//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");  
if (!
$MZalbumresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {  
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>');  

echo(
'<a href="' $copperminepath .  
'/thumbnails.php?album=' $albumid '">' .  
$MZalbumname['title'] . '</a>' '</p>');  
}  

if (! @
mysql_select_db('coppermine') ) {  
die( 
'<p>Unable to reload the main website ' .  
'database at this time.</p>' );  
}  

?>



gallery_center_toprated_block.php
Code: [Select]

<?php  

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/gallery';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''root'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) {  
echo( 
'<p>Unable to connect to the ' .  
'database server at this time.</p>' );  
exit();  
}  

//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine') ) { 
die( 
'<p>Unable to locate the picture ' .  
'database at this time.</p>' );  
}  

//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY pic_rating desc LIMIT 0,6");  
if (!
$MZresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZrow mysql_fetch_array($MZresult) ) {  

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location 

// echo('<P ALIGN=center>');  

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=60 height=50>' '</a> &nbsp;&nbsp;'); //outputs path from /userspics 
}  

//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");  
if (!
$MZalbumresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {  
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>');  

echo(
'<a href="' $copperminepath .  
'/thumbnails.php?album=' $albumid '">' .  
$MZalbumname['title'] . '</a>' '</p>');  
}  

if (! @
mysql_select_db('coppermine') ) {  
die( 
'<p>Unable to reload the main website ' .  
'database at this time.</p>' );  
}  

?>



gallery_center_topview_block.php
Code: [Select]

<?php  

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath '/gallery';  //***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('localhost''root'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) {  
echo( 
'<p>Unable to connect to the ' .  
'database server at this time.</p>' );  
exit();  
}  

//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('coppermine') ) { 
die( 
'<p>Unable to locate the picture ' .  
'database at this time.</p>' );  
}  

//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY hits desc LIMIT 0,6");  
if (!
$MZresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZrow mysql_fetch_array($MZresult) ) {  

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name 
$pos $MZrow['pid'];      //This finds the picture's coppermine location 

// echo('<P ALIGN=center>');  

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

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=60 height=50>' '</a> &nbsp;&nbsp;'); //outputs path from /userspics 
}  

//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");  
if (!
$MZalbumresult) {  
die(
'<p>Error performing query: ' mysql_error() .  
'</p>');  
}  

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {  
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>');  

echo(
'<a href="' $copperminepath .  
'/thumbnails.php?album=' $albumid '">' .  
$MZalbumname['title'] . '</a>' '</p>');  
}  

if (! @
mysql_select_db('coppermine') ) {  
die( 
'<p>Unable to reload the main website ' .  
'database at this time.</p>' );  
}  

?>

Title: Gallery Block for my phpBB portal
Post by: Inertia on November 10, 2003, 01:59:30 pm
Thank you so much! I shall give that a try as soon as i get home from work tonight!

-Fingers crossed!-

:)
Title: Gallery Block for my phpBB portal
Post by: Zarsky on November 10, 2003, 05:15:54 pm
DaMysterious,

Great addition to my code.  Also...I want to point out to everyone that this code DOES NOT obey permissions set within the gallery.  If I get some time perhaps I will tray to add some permission checking, but I do not think this will be easily accomplished. I was thinking the only way it will work is if you are using some form of BBS integration.  Anyone have any ideas?
Title: Gallery Block for my phpBB portal
Post by: Inertia on November 10, 2003, 11:46:00 pm
Thank you thank you so much!

It works great now, especially after I downloaded the X-treme mod.

I actually had the code in the TPL file from yesterday, and after I uploaded the mod, it worked immediately without creating a "file.php". I just have the code right in the main TPL file.

Its exactly what I needed!

Thanks again! :)
Title: Gallery Block for my phpBB portal
Post by: TheNakedMan on November 12, 2003, 07:39:59 am
what if I wanted to have 4-5 random pics like this or newest on the main forum page.  

What would I change?
Title: Gallery Block for my phpBB portal
Post by: Valerie on January 31, 2004, 04:14:36 pm
Hi, I was wondering how the password & username are protected from being seen in these files. (I'm learning - but my knowledge is still limited.)

 These codes really looks like what I want. They work fine in regular php files, correct? What if I want to put more than one random pic on my main page but keep them in a scroll box so they only take up a certain amount of room on the page - just set a basic scroll box around it? My memory isn't the best - anyone mind slapping that code here for reference? (Just asking)

Also, is there a way to control the thumbnail size that shows up with this code? Thank you!
Title: Gallery Block for my phpBB portal
Post by: Joachim Müller on February 01, 2004, 01:55:46 pm
Passwords are not stored within files, but in the mySQL db, no need to worry about that.

GauGau
Title: Where is the coder from?
Post by: gmarik on February 16, 2004, 06:29:04 pm
How much this is phpBB revelant and could it be suded with some modificatoins over vBulletin 3.0? Ady idea?!  :shock:
Title: Gallery Block for my phpBB portal
Post by: DesiFlavour on March 05, 2004, 02:23:34 am
Hey guys, excellent feature!

Ive managed to get that page working fine, only problem now is how do i place it on the portal.

I would if possble like to replace it with the top announcement table in the middle of the portal as it displays 5 most recent ones which is abit too many anyway.

If not then can you tell me how i can just plce the random pic table just below the welcome table in the middle.

As in what code do i need to include in the portal_body.tpl or portal.php.

I've got a rough idea so if you can just guide be please  :)

Thank you, would very much appreciate your help!  :)
Title: Gallery Block for my phpBB portal
Post by: laziale4ever on March 16, 2004, 06:19:29 pm
Thanks guys for the great feature..

I just made a tiny addition to the newest pics.. when you require the admin approval for some uploads.. So, it wont display pictures before approving them.

in the original code:

Code: [Select]
$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY pid DESC LIMIT 0,6");  

my edited code:

Code: [Select]
$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures WHERE approved = 'YES' ORDER BY pid DESC LIMIT 0,6");  
Title: Gallery Block for my phpBB portal
Post by: r4merlin on March 21, 2004, 05:00:36 pm
Quote
Hey guys, excellent feature!

Ive managed to get that page working fine, only problem now is how do i place it on the portal.

I would if possble like to replace it with the top announcement table in the middle of the portal as it displays 5 most recent ones which is abit too many anyway.

If not then can you tell me how i can just plce the random pic table just below the welcome table in the middle.

As in what code do i need to include in the portal_body.tpl or portal.php.

I've got a rough idea so if you can just guide be please  

Thank you, would very much appreciate your help!


Same where could you explain that  part of it
Title: Gallery Block for my phpBB portal
Post by: sdalgleish on March 22, 2004, 08:06:01 pm
I've just been playing with this.  I had a little trouble getting it started because it kept telling me that 'thumb_' was not a defined constant.  The solution is to:

Replace
Code: [Select]
echo('<IMG SRC="' . $copperminepath . '/albums/');           //append base dir structure
echo($MZrow['filepath'].thumb_.$MZrow['filename'] .
     '" alt=' . $MZrow['filename'] . ' '. 'border=0>' . '</a>'); //outputs path from /userspics


with
Code: [Select]
echo('<IMG SRC="' . $copperminepath . '/albums/');           //append base dir structure
echo($MZrow['filepath']. 'thumb_' .$MZrow['filename'] .
     '" alt=' . $MZrow['filename'] . ' '. 'border=0 align=center>' . '</a>'); //outputs path from /userspics


All that is changed is putting single quote (') around the word thumb_ so that it's a string and not a constant.  Seems to work for me now.  Hope that's useful to someone.

Nice mod zarsky99 - I like it!
Title: Gallery Block for my phpBB portal
Post by: futtlui on April 15, 2004, 09:15:53 pm
just a question: i'm new to this portal stuff but i'd like to have one soon for my phpbb.
of course it should include a block with pictures of my existing coppermine gallery.

Does it matter, which portal i choose?
About which one are you talking about in this thread?
Smartor's ezPortal? AWSW's Portal? Another one?

BTW I don't want to use nuke or one of these big cms-things.

TIA
futtlui
Title: Re: Gallery Block for my phpBB portal
Post by: aem on April 25, 2004, 07:27:12 pm
I tried this script and when i run it it went to a page with this

Quote
Unable to connect to the database server at this time.

What could i be doing wrong?
Title: Re: Gallery Block for my phpBB portal
Post by: DaMysterious on April 25, 2004, 10:49:52 pm
just a question: i'm new to this portal stuff but i'd like to have one soon for my phpbb.
of course it should include a block with pictures of my existing coppermine gallery.

Does it matter, which portal i choose?
About which one are you talking about in this thread?
Smartor's ezPortal? AWSW's Portal? Another one?

BTW I don't want to use nuke or one of these big cms-things.

TIA
futtlui

I did talk about Smartor's EZ-Portal. But the codes should work in other evironments also.
Title: Re: Gallery Block for my phpBB portal
Post by: evildave on May 11, 2004, 12:34:03 am
First post....

My site is not a phpBB portal just a standard php site. I just wanted to say thanks. I've been looking for a hack like this. I have coppermine installed on a different server then my website and this hack works great  :)

I'm just getting started with my site but heres the link if you want to check it out.
site: http://evildave.jaywebdesigns.com

Thanks again.
Title: Permission rights on random pictures on site
Post by: apassio on September 10, 2004, 08:11:22 am
I have implemented the code in http://forum.coppermine-gallery.net/index.php?topic=1196.msg6902#msg6902, see www.dophan.com (http://www.dophan.com).

However, I read and did notice that some random pictures coming up also belong to other users who have registered on my site (so also private pictures). This confirms that all pictures in the database are viewable by this script.

How can I limit the random showing to public albums only?

Thanks

Title: Re: Permission rights on random pictures on site
Post by: Joachim Müller on September 10, 2004, 08:15:37 am
The hack you refer to is based on ssi.php (a mod I built a long time ago) that doesn't take permissions into account (that's why I recommend not using it any longer, nor use any mods that are based on it). There's no easy fix - if you have privacy concerns, just don't use the hack, sorry.

Joachim

P.S. Any reason for posting a new thread instead of replying to the one you're refering to? Probably not, that's why I merged them.
Title: Re: Gallery Block for my phpBB portal
Post by: cjaiz on September 17, 2004, 07:01:51 am
I took the code that you have here and modified it a little.

1.  It looks for a random Album and it only will display albums that are available to everyone.
2. I have included variables at the start of the code to turn items on and off the variable will let you do the following:
        center phot (on/off)
        display random albums with random pictures (This only displays public albums)
        display random photo's (this will show all public and private files)
        you can link to the album itself or go to the index.php file to display all albums
        I have an include that pulls info from config.inc.php
       

Code: [Select]
<?php 
//
// Change the path to the location of your config.inc.php file
// example this is how my system is setup for the file structure
// /public_html/scripts/cpg131/include/config.inc.php
// the gallery_block.php is located in ths scripts directory
// if you place the script in the Copermine directory the line would look like this
// include ('include/config.inc.php');
// Hope this helps you out with the file name

include ('cpg131/include/config.inc.php');

// 
//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 
// *** example 
// *** http://www.yourdomain.com/scripts/cpg131/index.php is how you start your Photo Gallery
// ** then toy would put the folowinf in here /scripts/cpg131
//

$copperminepath '/scripts/cpg131';  //***YOU MUST CHANGE THIS*** 

//
// Set up version of Copermine for gallery_block
// you can find out the info in the include/config.inc.php
// check the line labeled $CONFIG['TABLE_PREFIX'] =                "get this info"
// once you have this the 
//
// Set center Var 
// Set Display Album Name above Photo
// 0 = no 
// 1 = yes 
//

$centvar "1"// This Variable sets the photo to Center
$albname "0"// This Variable sets the Album Name to appear above the Photo

//
// 0 = random album (this will only display albums that are viewable to the Everybody (Public Photo's)
// 1 = Random Pictures (This will display any file that has been approved Private or Public)
//
 
$allphoto "0"// This Variable set to choose Random Albmus or just Random Pictures 

//
// *************************************************************************
// DO NOT CHANGE ANYTHING BELOW THOS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// *************************************************************************
//

//
// This sets variables from the config.inc.php file
//

$dbalbum "albums";
$dbpictures "pictures";

$cpgver_album $CONFIG['TABLE_PREFIX'].$dbalbum ;
$cpgver_pictures $CONFIG['TABLE_PREFIX'].$dbpictures ;
$host $CONFIG['dbserver'];
$username $CONFIG['dbuser'];
$userpass $CONFIG['dbpass'];
$cpgdb $CONFIG['dbname'];

// 
//This connects to the mysql DB 
//***change username and password below*** 
// 

$MZrandompic = @mysql_connect("$host""$username""$userpass"); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


// 
//select photo DB 
// 

if (! @mysql_select_db("$cpgdb") ) { 
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


//
// Select Databases to use
//

if ($allphoto == "0") {

$query1 "SELECT * FROM .$cpgver_album WHERE visibility = 0 ORDER BY RAND() LIMIT 0,1"
$result1 mysql_query($query1) or die("Query failed : " mysql_error()); 

//
// Assign Var from sql data base's 
//

while ($newarray mysql_fetch_array($result1)) {
$aid $newarray['aid'];
$title $newarray['title'];
if ($centvar == "1") echo ("<center>");
if ($albname == "1") {
echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>$title </a><br>");
if ($centvar == "1") echo ("</center>");
}
}
}
if (
$allphoto == "0") {
$query2 "SELECT * FROM .$cpgver_pictures WHERE aid = '$aid' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 
}

if (
$allphoto == "1") {
$query2 "SELECT * FROM .$cpgver_pictures WHERE approved = 'YES' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 
}

while (
$newarray1 mysql_fetch_array($result2)) {
$filepath $newarray1['filepath'];
$filename $newarray1['filename'];
if ($centvar == "1") echo ("<center>");
if ($allphoto == "0") {
echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>");
echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
} else {
echo ("<a target '_blank' href= '$copperminepath/index.php'>");
echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
}
if ($centvar == "1") echo ("</center>");
}

?>

Title: Re: Gallery Block for my phpBB portal
Post by: uk_martin on September 20, 2004, 10:09:58 pm
Apologies for being a bit lost with PHP coding, so to those who know what they are doing this might sound a bit stupid...but...

I like the idea of having a most recent upload block in EXPortal, in the left hand side below the navigation block.

How is the portal_body.tpl edited to include the block?

Is it possible to have 2 - 4 thumbnails in a column down the side of the page rather than just one to represent the most recent (up to) 4 pics uploaded?

I assume that the coding given earlier is for a new PHP file to be created and uploaded in the forums root folder, or am I mistaken? Or is the portal.php file edited to add this code?

I installed coppermine first and then installed phpbb into the Coppermine database. Will this have an effect on any of the coding?
Title: Re: Gallery Block for my phpBB portal
Post by: Joachim Müller on September 21, 2004, 10:04:58 am
please keep in mind that there are only few phpbb experts around here - posting feature requests on what you want to accomplish with a non-coppermine application will probably go un-echoed. Ask this question in another way on the board that deals with phpbb or the mod you're refering to, like this: "How can I add custom php code to portal.php". In the best case, they'll tell you which place the code should go to. Then have a look at the rss feed or random image include mods, and paste the code into the place you have been told to use.

Joachim
Title: Re: Gallery Block for my phpBB portal
Post by: cjaiz on September 22, 2004, 11:25:46 pm
I have figured this out if anyone else is intrested I did the following.

1. Installed eXtreme style mod can be found at http://www.phpbb.com/phpBB/viewtopic.php?t=125251 (this lets me place php code in the overall_header.tpl)

2. I wrote a php scripts that will pull photo thumbnails from coppermine I have tested it with 1.3.1 and 1.3.2 Here is the code.


gallery_block.php
Code: [Select]

<?php 
// 
// Change the path to the location of your config.inc.php file 
// example this is how my system is setup for the file structure 
// /public_html/scripts/cpg131/include/config.inc.php 
// the gallery_block.php is located in ths scripts directory 
// if you place the script in the Copermine directory the line would look like this 
// include ('include/config.inc.php'); 
// Hope this helps you out with the file name 

include ('cpg132/include/config.inc.php'); 

// 
//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 
// *** example 
// *** http://www.yourdomain.com/scripts/cpg131/index.php is how you start your Photo Gallery 
// ** then toy would put the folowinf in here /scripts/cpg131 
// 

$copperminepath '/scripts/cpg132';  //***YOU MUST CHANGE THIS*** 

// 
// Set center Var 
// Set Display Album Name above Photo 
// 0 = no 
// 1 = yes 
// 

$centvar "1"// This Variable sets the photo to Center 
$albname "0"// This Variable sets the Album Name to appear above the Photo 

// 
// 0 = random album (this will only display albums that are viewable to the Everybody (Public Photo's) 
// 1 = Random Pictures (This will display any file that has been approved Private or Public) 
// 
  
$allphoto "0"// This Variable set to choose Random Albmus or just Random Pictures 

// 
// This is to set the Visiabilty for the albums 
// 0 = Public Albums 
// 2 = Registered Users album 
// 

$viz "2"
// 
// ************************************************************************* 
// DO NOT CHANGE ANYTHING BELOW THOS LINE UNLESS YOU KNOW WHAT YOU ARE DOING 
// ************************************************************************* 
// 

// 
// This sets variables from the config.inc.php file 
// 

$dbalbum "albums"
$dbpictures "pictures"

$cpgver_album $CONFIG['TABLE_PREFIX'].$dbalbum 
$cpgver_pictures $CONFIG['TABLE_PREFIX'].$dbpictures 
$host $CONFIG['dbserver']; 
$username $CONFIG['dbuser']; 
$userpass $CONFIG['dbpass']; 
$cpgdb $CONFIG['dbname']; 

// 
//This connects to the mysql DB 
//***change username and password below*** 
// 

$MZrandompic = @mysql_connect("$host""$username""$userpass"); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


// 
//select photo DB 
// 

if (! @mysql_select_db("$cpgdb") ) { 
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


// 
// Select Databases to use 
// 

if ($allphoto == "0") { 

$query1 "SELECT * FROM .$cpgver_album WHERE visibility = '$viz' ORDER BY RAND() LIMIT 0,1"
$result1 mysql_query($query1) or die("Query failed : " mysql_error()); 

// 
// Assign Var from sql data base's 
// 

while ($newarray mysql_fetch_array($result1)) { 
   
$aid $newarray['aid']; 
   
$title $newarray['title']; 
   if (
$centvar == "1") echo ("<center>"); 
   if (
$albname == "1") { 
   echo (
"<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>$title </a><br>"); 
   if (
$centvar == "1") echo ("</center>"); 
   } 


if (
$allphoto == "0") { 
$query2 "SELECT * FROM .$cpgver_pictures WHERE aid = '$aid' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 


if (
$allphoto == "1") { 
$query2 "SELECT * FROM .$cpgver_pictures WHERE approved = 'YES' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 


while (
$newarray1 mysql_fetch_array($result2)) { 
   
$filepath $newarray1['filepath']; 
   
$filename $newarray1['filename']; 
   if (
$centvar == "1") echo ("<center>"); 
   if (
$allphoto == "0") { 
   echo (
"<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>"); 
   echo (
"<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>"); 
   } else { 
   echo (
"<a target '_blank' href= '$copperminepath/index.php'>"); 
   echo (
"<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>"); 
   } 
   if (
$centvar == "1") echo ("</center>"); 
   } 

?>

 


3. Then edited the overall_header.tpl file in phpBB Template directory with this code at the end of the script.

Code: [Select]

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="20%"><?php 
include ('/home/location_of_the_script/public_html/scripts/gallery_block.php'); 
?>
</td>
    <td width="20%"><?php 
include ('/home/location_of_the_script/public_html/scripts/gallery_block.php'); 
?>
</td>
    <td width="20%"><?php 
include ('/home/location_of_the_script/public_html/scripts/gallery_block.php'); 
?>
</td>
    <td width="20%"><?php 
include ('/home/location_of_the_script/gallery_block.php'); 
?>
</td>
    <td width="20%"><?php 
include ('/home/location_of_the_script/gallery_block.php'); 
?>
</td>
  </tr>
</table>
 

you will need to replace /home/location_of_the_script/gallery_block.php with the location of the gallery_block.php script

I have optons added to the galley_block.php file so you can display all photo's and once clicked on it will take you to the copermine main page or you can select random albums based on the vis of the directory example if you only want to display albums that are public you need to set the $viz var to 0 and registered albums to 2 also you can display the album name above the photo. if you select random albums if you click on the photo it will take you to that album in copermine. there are other options in the script and it is comented so you can turn them on or off if you like. The script will also pull the database name username and password from copermine so you do not have to look this info up.

Hope this helps some people out I wrote this because I want to add a gallery to my phpbb with more features then smartor photo gallery and not to have to buy photopost.
Title: Re: Gallery Block for my phpBB portal
Post by: uk_martin on September 26, 2004, 10:52:02 pm
Thanks for this, but I got the following error:

Quote
Warning: main(cpg132/include/config.inc.php): failed to open stream: No such file or directory in /home/ukmartin/public_html/forums/gallery_block.php on line 11

Warning: main(cpg132/include/config.inc.php): failed to open stream: No such file or directory in /home/ukmartin/public_html/forums/gallery_block.php on line 11

Warning: main(): Failed opening 'cpg132/include/config.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/cpanel/Cpanel') in /home/ukmartin/public_html/forums/gallery_block.php on line 11

Unable to locate the picture database at this time.

I created the GALLERY_BLOCK.PHP file as per your code, and put it in the root of the forum folder of www.ukmartin.com

I amended the OVERALL_HEADER.PHP file with this code, which reflects the paths to my files:

Quote
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="20%"><?php
include ('/home/ukmartin/public_html/forums/gallery_block.php');
?></td>
    <td width="20%"><?php
include ('/home/ukmartin/public_html/forums/gallery_block.php');
?></td>
    <td width="20%"><?php
include ('/home/ukmartin/public_html/forums/gallery_block.php');
?></td>
    <td width="20%"><?php
include ('/home/ukmartin/public_html/forums/gallery_block.php');
?></td>
    <td width="20%"><?php
include ('/home/ukmartin/public_html/forums/gallery_block.php');
?></td>
  </tr>
</table>


Can you tell me where Ihave gone wrong?

Also, is it possible for something similar to be created to act as a block down the side of EZ Portal, (presumably needing the PORTAL_BODY.TPL file modding) so that some thumbnails (max width 125px each) can appear in a column down the side of the page?

Thanks

Martin
Title: Re: Gallery Block for my phpBB portal
Post by: cjaiz on October 02, 2004, 11:55:17 pm
Hello,

The error you are getting is a path issue error.  I looked at you website and you will need to edit line 11 on the gallery_block.php if I am not mastaken you will need to change the line to read as followed

Code: [Select]
include ('../coppermine/include/config.inc.php');

and also change the following code also in the gallery_block.php

Code: [Select]
$copperminepath = '/scripts/cpg132';  //***YOU MUST CHANGE THIS***

to the following:

Code: [Select]
$copperminepath = '/coppermine';  //***YOU MUST CHANGE THIS***

you can try this and let me know but I think this will solve the problem with the error you are getting if not let me know if you got it working or not.

Thank you and good luck.
Title: Re: Gallery Block for my phpBB portal
Post by: richards on October 08, 2004, 08:57:28 pm
[edit GauGau]nested quotes removed to make this thread more readible[/edit]
...
man i have tried to get this to work so many times. Is there anyone to break this down for me? Where exactly to put ther username and password and stuff like that.
Title: Re: Gallery Block for my phpBB portal
Post by: cynikalsam on December 20, 2004, 11:30:01 pm
I've been using the gallery_center_newest_block.php code on my phpbb index for a few weeks, and it works great. Right now i am in the process of re-designing the profile_viewbody.tpl, and i had an idea i was hoping one of you could help me with.

Since i have coppermine and phpbb integrated, each user has their own gallery. I think it would be cool to put a block of latest images (from their gallery only) on their profile. So, my latest uploads would appear on my profile, and your latest uploads would appear on your profile.

Would anyone know how to modify the code to accomplish this?  ???
Title: Re: Gallery Block for my phpBB portal
Post by: Nibbler on February 26, 2005, 07:19:20 pm
You are using an absolute server path to the file. Use either a relative path ie. gallery/gallery_block.php or a full server path.
Title: Re: Gallery Block for my phpBB portal
Post by: TexAcoon on February 28, 2005, 07:30:08 am
In my code below, for some reason it will not show up on my portal at http://www.amadistrictii.org

Code: [Select]
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" align="center" height="20"><span class="genmed"><b>RANDOM PHOTOS</b>
</span></td></tr>
<tr>
<td class="row1" align="center"><span class="genmed" style="line-height=150%">
<?php include('/home/dwebmaster/domains/amadistrictii.org/public_html/amad2/gallery/gallery_block.php')?>
</span></td>
</tr>
</table>
<br />

However, making up a fake page called "port.php" at: http://www.amadistrictii.org/amad2/templates/subSilver/port.php  it works fine...
My gallery block is located at: http://www.amadistrictii.org/amad2/gallery/gallery_block.php

Any ideas as to why it does not post itself on the portal page? .. Thanks!
Title: Re: Gallery Block for my phpBB portal
Post by: lsd_se on March 25, 2005, 03:37:23 am
I took the code that you have here and modified it a little.

1.  It looks for a random Album and it only will display albums that are available to everyone.
2. I have included variables at the start of the code to turn items on and off the variable will let you do the following:
        center phot (on/off)
        display random albums with random pictures (This only displays public albums)
        display random photo's (this will show all public and private files)
        you can link to the album itself or go to the index.php file to display all albums
        I have an include that pulls info from config.inc.php
       

Code: [Select]
<?php 
//
// Change the path to the location of your config.inc.php file
// example this is how my system is setup for the file structure
// /public_html/scripts/cpg131/include/config.inc.php
// the gallery_block.php is located in ths scripts directory
// if you place the script in the Copermine directory the line would look like this
// include ('include/config.inc.php');
// Hope this helps you out with the file name

include ('cpg131/include/config.inc.php');

// 
//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 
// *** example 
// *** http://www.yourdomain.com/scripts/cpg131/index.php is how you start your Photo Gallery
// ** then toy would put the folowinf in here /scripts/cpg131
//

$copperminepath '/scripts/cpg131';  //***YOU MUST CHANGE THIS*** 

//
// Set up version of Copermine for gallery_block
// you can find out the info in the include/config.inc.php
// check the line labeled $CONFIG['TABLE_PREFIX'] =                "get this info"
// once you have this the 
//
// Set center Var 
// Set Display Album Name above Photo
// 0 = no 
// 1 = yes 
//

$centvar "1"// This Variable sets the photo to Center
$albname "0"// This Variable sets the Album Name to appear above the Photo

//
// 0 = random album (this will only display albums that are viewable to the Everybody (Public Photo's)
// 1 = Random Pictures (This will display any file that has been approved Private or Public)
//
 
$allphoto "0"// This Variable set to choose Random Albmus or just Random Pictures 

//
// *************************************************************************
// DO NOT CHANGE ANYTHING BELOW THOS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// *************************************************************************
//

//
// This sets variables from the config.inc.php file
//

$dbalbum "albums";
$dbpictures "pictures";

$cpgver_album $CONFIG['TABLE_PREFIX'].$dbalbum ;
$cpgver_pictures $CONFIG['TABLE_PREFIX'].$dbpictures ;
$host $CONFIG['dbserver'];
$username $CONFIG['dbuser'];
$userpass $CONFIG['dbpass'];
$cpgdb $CONFIG['dbname'];

// 
//This connects to the mysql DB 
//***change username and password below*** 
// 

$MZrandompic = @mysql_connect("$host""$username""$userpass"); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


// 
//select photo DB 
// 

if (! @mysql_select_db("$cpgdb") ) { 
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


//
// Select Databases to use
//

if ($allphoto == "0") {

$query1 "SELECT * FROM .$cpgver_album WHERE visibility = 0 ORDER BY RAND() LIMIT 0,1"
$result1 mysql_query($query1) or die("Query failed : " mysql_error()); 

//
// Assign Var from sql data base's 
//

while ($newarray mysql_fetch_array($result1)) {
$aid $newarray['aid'];
$title $newarray['title'];
if ($centvar == "1") echo ("<center>");
if ($albname == "1") {
echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>$title </a><br>");
if ($centvar == "1") echo ("</center>");
}
}
}
if (
$allphoto == "0") {
$query2 "SELECT * FROM .$cpgver_pictures WHERE aid = '$aid' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 
}

if (
$allphoto == "1") {
$query2 "SELECT * FROM .$cpgver_pictures WHERE approved = 'YES' ORDER BY RAND() LIMIT 0,1"
$result2 mysql_query($query2) or die("Query failed : " mysql_error()); 
}

while (
$newarray1 mysql_fetch_array($result2)) {
$filepath $newarray1['filepath'];
$filename $newarray1['filename'];
if ($centvar == "1") echo ("<center>");
if ($allphoto == "0") {
echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>");
echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
} else {
echo ("<a target '_blank' href= '$copperminepath/index.php'>");
echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
}
if ($centvar == "1") echo ("</center>");
}

?>



where would I put this coding?
Thanks!
Title: Re: Gallery Block for my phpBB portal
Post by: vuud on March 25, 2005, 05:01:30 am

Hello,

Has anyone tried just implementing copperminefetch to do this?  I am not sure if it would work, but I don't see why it would not.  It only takes like three lines of php to implement.  If anyone has tried it and could not make it work, please let me know. 

http://cpmfetch.fistfullofcode.com or the thread in the mods forum here. 

If you do try it, go with the latest dev version (its gonna be stable by the end of March.

Vuud
Title: Re: Gallery Block for my phpBB portal
Post by: Horizon on March 28, 2005, 04:45:54 pm
Code: [Select]
Error performing query: Table 'foto.cpg11d_pictures' doesn't existWhere is the problem? ::)
Title: Re: Gallery Block for my phpBB portal
Post by: Nibbler on March 28, 2005, 05:33:41 pm
Change cpg11d_ to the actual prefix you chose during installation.
Title: Re: Gallery Block for my phpBB portal
Post by: ISBB on April 04, 2005, 09:54:11 pm
How hard would it be to do a SINGLE Random image in Smartors Portal... I only want one maybe 2 at the most... i was looking at VUUD's Fetch thing and was wondering how well that would work w/ the portal.. and being able to change the layout of the pictures would be cool too but im just simply looking for one..
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 06, 2005, 03:11:40 am
I have smartors now for my phpBB Plus and im getting rid of it for a block that will complement my coppermine gallery. I have the script for it if anyone can help me with putting a block on my portal for my cpg.
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 06, 2005, 04:29:59 am
Ok im getting this error when trying the first code listed in this thread. What am i missing?

Code: [Select]
Error performing query: Table 'texascam_gallery.cpg11d_pictures' doesn't exist
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 06, 2005, 05:06:19 am
Ok have thinking for some time i figured out that the 'texascam_gallery.cpg11d_pictures'  was a table in my DB i just changed it to 'texascam_gallery.cpg132_pictures'  to match my DB. Now when i click on the Album link on the block it takes me to a solid white screen with one picture on it and the catagory below it and then this message:

"Unable to reload the main website database at this time."

Also it doesnt show a random pic in the block. Now im stuck and dont know where to go from here. Any help would be great.
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 06, 2005, 05:40:49 am
Ok i got the "Unable to reload the main website database at this time." message to go away when you click on the album link on the block. I just cant seem to get random pics to show in the block. Any ideas?
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 07, 2005, 04:02:26 am
Can anyone Help please?
Title: Re: Gallery Block for my phpBB portal
Post by: ISBB on April 07, 2005, 04:15:13 am
Texan78  use VUUD's software the CPMFetch.. it works great..

http://www.zr2nw.com   CPG,phpBB,ezPortal by smartor

go to http://smartor.is-root.com  look in his forums for ezPortal Support in there it will teach you how to add a block to your portal.  BUT ill post up how i did mine..

Code: [Select]
  <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
      <tr>
      <td class="catHead" height="25"><span class="genmed"><b>Random Photo</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="center"><span class="gensmall"><br /><img src="/cpmfetch/cfimageget.php"><br /><br /><img src="/cpmfetch/cfimageget.php?happyhappy=joyjoy"><br /><br /></span></td>
      </tr>
</table>
  </form>

  <br />

</td>
  </tr>
</table>

<br />


that is the very last section of my code... the last <br /> is the last line of portal_body.tpl

HTH
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 08, 2005, 02:08:32 am
Thanks for the code in the info for the cpmfetch. I havent got it working yet but the code for the portal works great. The one thing about my portal is i already have a smartors portal for the smartors album. So does anyone know where the php file is where i would insert the script into the smartors portal to make the cpg work. I would rather use that portal since it is already layed out for my theme. The code for the portal you gave me will defiantely work and i can try to skin it for my template.
Title: Re: Gallery Block for my phpBB portal
Post by: ISBB on April 08, 2005, 02:49:20 am
you make no sense in your last post texan...

Which are you using Smartors photo album or CPG??? if both WHY???

And the code i put up was to add a block to the portal_body.tpl of smartors portal.. that should have NO effect on your theme at all..

Im kinda confused at what your trying to accomplish
Title: Re: Gallery Block for my phpBB portal
Post by: Texan78 on April 08, 2005, 05:10:29 am
Well i have phpBB2 Plus 1.53 which is like phpBB on steroids. It's completely modded out.  By defualt it comes with the Smartor ezPortals and the Smartor album. I have changed all the navigation links to point to my cpg which is what i wanna keep and use. BUT the portal that is already on there by defalut that shows random pics is a smartors album. It would be nice to use the portal that is already built in BUT display my cpg in it instead of the smartors album. Bascily i wanna keep the portal but display my cpg instead of smartors in it.

So the code you gave me you correct on, it adds a portal to my portal body, BUT i already have one by deflaut, get what im saying. Also the code you gave me is diffferent from what my theme is. Dont get my wrong it was a HUGE help and if i cant do what i would like to do then i will just mod the code you gave me.

If you want a visual of what i am talking about take a look at my site. both are on the bottom. One on the left is smartors portal (which i would like to display my cpg in) One of the right is the portal code you gave me. http://www.texascampingforum.com/forum/portal.php

Hope this make a little more sense, sorry im a little tired... :)
Title: Re: Gallery Block for my phpBB portal
Post by: fferro on August 26, 2005, 08:27:44 pm
Hi, "PHPBB2" forum with default theme "subSilver".
How to remove the border and the spaces between inserted images with this mod?
Do I have to create a new CSS tag? Where?
thank you
Title: Re: Gallery Block for my phpBB portal
Post by: Mr Tee on September 12, 2005, 09:38:51 pm
OK I have been looking through this thread and I suspect somewhere in here is what I ma looking for but I am having problems sorting out which code to use. At the risk of having someone scream at me I will apologise in advance.

My site portal http://www.thestudio-online.co.uk has two of the latest images from my phpBB album mod, as you will see. It also has links to the latest comment and another link to the latest uploaded images, since a users last visit, on the right.

I now have coppermine installed and am starting to use this instead of the phpBB album mod. I would like to, at least, have the two latest images on the portal display the two latest from coppermine instead. Ideally I would like the two links on the right to link to coppermine too, but the images are more important. Can anyone point me in the right direction PLEASE.

Many thanks.
Title: Re: Gallery Block for my phpBB portal
Post by: vuud on September 13, 2005, 04:53:32 pm
OK I have been looking through this thread and I suspect somewhere in here is what I ma looking for but I am having problems sorting out which code to use. At the risk of having someone scream at me I will apologise in advance.

My site portal http://www.thestudio-online.co.uk has two of the latest images from my phpBB album mod, as you will see. It also has links to the latest comment and another link to the latest uploaded images, since a users last visit, on the right.

I now have coppermine installed and am starting to use this instead of the phpBB album mod. I would like to, at least, have the two latest images on the portal display the two latest from coppermine instead. Ideally I would like the two links on the right to link to coppermine too, but the images are more important. Can anyone point me in the right direction PLEASE.

Many thanks.


http://cpmfetch.fistfullofcode.com

or here

http://forum.coppermine-gallery.net/index.php?topic=19528.0




Title: Re: Gallery Block for my phpBB portal
Post by: willstein on September 26, 2005, 05:30:51 pm
Is there some mod to "refresh" the images, without refreshing the whole page?
Title: Re: Gallery Block for my phpBB portal
Post by: bobby2 on January 26, 2006, 10:05:42 pm
Hi guys.

I'm from Germany ;-D
My question is: is it possible to have the "random picture" feature from cpmfetch in my Burning Board Lite (check www.fuxei.de (http://www.fuxei.de) ) Above the Buttons...

Cya

Bobby
Title: Re: Gallery Block for my phpBB portal
Post by: Joachim Müller on January 27, 2006, 06:15:00 am
If you have questions concerning the cpmFetch mod, you'll have to reply to a thread that deals with it instead of replying to an unrelated one ::)
Title: Re: Gallery Block for my phpBB portal
Post by: xsportseeker on March 14, 2006, 04:44:55 am
Great! Exactly what I was needing to get a random picture on a mxBB Portal Block.
Made some changes to the code, now it shows the complete picture (not just the thumbnail), and links directly to the picture (with displayimage.php using aid and pid).
Only problem now is... flash and video files.
Is there a simple way to test if the file is picture, flash or video, and take different actions on each case?

Also... is there another way to generate an external page with random picture linking to the picture page on cpg? Just asking... maybe there's a better sollution I don't know about. I was wondering if maybe there was a way to use the random picture function that display random pictures on cpg portal...

Anyways, if someone wants to use this code with the changes I made, wait a little bit more 'cuz I want to clean up the whole thing.
Title: Re: Gallery Block for my phpBB portal
Post by: xsportseeker on March 14, 2006, 03:45:47 pm
mmmkay, made some changes in the code:

Now, it generates a single page, with a random picture. By changing a variable (showthumb) you can choose it to display the full size picture, thumbnail or the middle sized picture.
Clicking on the picture will redirect you to the main picture page on the gallery.
Notice I deleted lots of stuff... there's no linking to galleries or main pages now.
I also changed stuff that was inside while loops. There maybe ways to erase completely some of those while loops, but I will have to study some more php to do it.

And last but not least, I'm studying a way to avoid the script to get errors from empty galleries. The code as it is now, will generate empty links if there are empty galleries.
I already found a way out, but am having some trouble with what the mysql_query function returns when it finds no entries in the database.

Finally, I still didn't find a way out for flash and video files. Maybe a simple function to check the extension of the file (with filename)... or maybe forcing the gallery to generate a thumbnail for each flash and video file (far more difficult).

Anyways, I'll probably be needing help from the pros!

Here's my updated code (randompic.php):

Code: [Select]
<?php 
//
// Change the path to the location of your config.inc.php file
// example this is how my system is setup for the file structure
// /public_html/scripts/cpg131/include/config.inc.php
// the gallery_block.php is located in ths scripts directory
// if you place the script in the Copermine directory the line would look like this
// include ('include/config.inc.php');
// Hope this helps you out with the file name

include ('include/config.inc.php');

// 
//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 
// *** example 
// *** http://www.yourdomain.com/stuff/cpg144/index.php is how you start your Photo Gallery
// ** then toy would put the folowing in here stuff/cpg144
//

$copperminepath '/cpg144'//***YOU MUST CHANGE THIS*** 

//
// Set up version of Copermine for gallery_block
// you can find out the info in the include/config.inc.php
// check the line labeled $CONFIG['TABLE_PREFIX'] = "get this info"
// once you have this the 
//
// Set center Var 
// Set Display Album Name above Photo
// 0 = no 
// 1 = yes 
//

$centvar 1// This Variable sets the photo to Center
$albname 0// This Variable sets the Album Name to appear above the Photo
$showthumb 2// This variable chooses between showing the complete picture, or thumbnail only - Choose 2 for reduced picture size.

//
// *************************************************************************
// DO NOT CHANGE ANYTHING BELOW THOS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// *************************************************************************
//

//
// This sets variables from the config.inc.php file
//

$dbalbum "albums";
$dbpictures "pictures";

$cpgver_album $CONFIG['TABLE_PREFIX'].$dbalbum ;
$cpgver_pictures $CONFIG['TABLE_PREFIX'].$dbpictures ;
$host $CONFIG['dbserver'];
$username $CONFIG['dbuser'];
$userpass $CONFIG['dbpass'];
$cpgdb $CONFIG['dbname'];

// 
//This connects to the mysql DB 
// 

$MZrandompic = @mysql_connect("$host""$username""$userpass"); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


// 
//select photo DB 
// 

if (! @mysql_select_db("$cpgdb") ) { 
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


//
// Select Databases to use
//

$try "0";
while (
$try == "0"){
  
$query1 "SELECT * FROM .$cpgver_album WHERE visibility = 0 ORDER BY RAND() LIMIT 0,1"
  
$result1 mysql_query($query1);
//
// Assign Var from sql data base's 
//
  
while ($newarray mysql_fetch_array($result1)) {
    
$aid $newarray['aid'];
    
$title $newarray['title'];
    
$pid $newarray['pid'];
    
$query2 "SELECT * FROM .$cpgver_pictures WHERE aid = '$aid' ORDER BY RAND() LIMIT 0,1"
    
$result2 mysql_query($query2) or $result2 0;

// or die("Query failed : " . mysql_error()); 
  
}
   if (! 
$result2 == 0$try "1";
}

  while (
$newarray1 mysql_fetch_array($result2)) {
    
$pid $newarray1['pid'];
    
$filepath $newarray1['filepath'];
    
$filename $newarray1['filename'];
  }
  
  if (
$albname) {
       echo (
"<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>$title </a><br>");
  }
  if (
$showthumb
    if (
$showthumb == 1$filename "thumb_".$filename;
    else 
$filename "normal_".$filename;
  if (
$centvar) echo ("<center>");
  echo (
"<a target '_blank' href= '$copperminepath/displayimage.php?album=$aid&pid=$pid&pos=1'>");
  echo (
"<img border='0' src= '$copperminepath/albums/$filepath$filename' > </a>");
  if (
$centvar) echo ("</center>");

?>

Title: Re: Gallery Block for my phpBB portal
Post by: xsportseeker on March 14, 2006, 03:51:54 pm
One more thing: I'm not so shure about that function made to put the filename on pagetitle. Seems to be wrong somehow. I'll look into it later on..
Title: Re: Gallery Block for my phpBB portal
Post by: uk_martin on December 31, 2006, 01:18:44 pm
The gallery block code that I am using on this site - www.ukmartin.com/phpbb2 is this:

<?php
//
// Change the path to the location of your config.inc.php file
// example this is how my system is setup for the file structure
// /public_html/scripts/cpg131/include/config.inc.php
// the gallery_block.php is located in ths scripts directory
// if you place the script in the Copermine directory the line would look like this
// include ('include/config.inc.php');
// Hope this helps you out with the file name

include ('/home/i-know-where/config.inc.php');

//
//***Enter Path information here***
//***absolute path to main coppermine directory***
// *** example
// *** http://www.yourdomain.com/scripts/cpg131/index.php is how you start your Photo Gallery
// ** then toy would put the folowinf in here /scripts/cpg131
//

$copperminepath = 'http://www.ukmartin.com/gallery';  //***YOU MUST CHANGE THIS***

//
// Set center Var
// Set Display Album Name above Photo
// 0 = no
// 1 = yes
//

$centvar = "1"; // This Variable sets the photo to Center
$albname = "0"; // This Variable sets the Album Name to appear above the Photo

//
// 0 = random album (this will only display albums that are viewable to the Everybody (Public Photo's)
// 1 = Random Pictures (This will display any file that has been approved Private or Public)
//
 
$allphoto = "0"; // This Variable set to choose Random Albmus or just Random Pictures

//
// This is to set the Visiabilty for the albums
// 0 = Public Albums
// 2 = Registered Users album
//

$viz = "0";
//
// *************************************************************************
// DO NOT CHANGE ANYTHING BELOW THOS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// *************************************************************************
//

//
// This sets variables from the config.inc.php file
//

$dbalbum = "albums";
$dbpictures = "pictures";

$cpgver_album = $CONFIG['TABLE_PREFIX'].$dbalbum ;
$cpgver_pictures = $CONFIG['TABLE_PREFIX'].$dbpictures ;
$host = $CONFIG['dbserver'];
$username = $CONFIG['dbuser'];
$userpass = $CONFIG['dbpass'];
$cpgdb = $CONFIG['dbname'];

//
//This connects to the mysql DB
//***change username and password below***
//

$MZrandompic = @mysql_connect("$host", "$username", "$userpass"); //***YOU MUST CHANGE THIS***

if (!$MZrandompic) {
echo( '<p>Unable to connect to the ' .
'database server at this time.</p>' );
exit();
}

//
//select photo DB
//

if (! @mysql_select_db("$cpgdb") ) {
die( '<p>Unable to locate the picture ' .
'database at this time.</p>' );
}

//
// Select Databases to use
//

if ($allphoto == "0") {

$query1 = "SELECT * FROM .$cpgver_album WHERE visibility = '$viz' ORDER BY RAND() LIMIT 0,1";
$result1 = mysql_query($query1) or die("Query failed : " . mysql_error());

//
// Assign Var from sql data base's
//

while ($newarray = mysql_fetch_array($result1)) {
   $aid = $newarray['aid'];
   $title = $newarray['title'];
   if ($centvar == "1") echo ("<center>");
   if ($albname == "1") {
   echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>$title </a><br>");
   if ($centvar == "1") echo ("</center>");
   }
}
}
if ($allphoto == "0") {
$query2 = "SELECT * FROM .$cpgver_pictures WHERE aid = '$aid' ORDER BY RAND() LIMIT 0,1";
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());
}

if ($allphoto == "1") {
$query2 = "SELECT * FROM .$cpgver_pictures WHERE approved = 'YES' ORDER BY RAND() LIMIT 0,1";
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());
}

while ($newarray1 = mysql_fetch_array($result2)) {
   $filepath = $newarray1['filepath'];
   $filename = $newarray1['filename'];
   if ($centvar == "1") echo ("<center>");
   if ($allphoto == "0") {
   echo ("<a target '_blank' href= '$copperminepath/thumbnails.php?album=$aid'>");
   echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
   } else {
   echo ("<a target '_blank' href= '$copperminepath/index.php'>");
   echo ("<img border='0' src= '$copperminepath/albums/$filepath/thumb_$filename' > </a>");
   }
   if ($centvar == "1") echo ("</center>");
   }

?>

A question in two parts follows from this:

1) Coppermine (in ../gallery ) has some multimedia files on display. These pose the gallery block a problem with displaying the thumbnails. Can the script introduce a filter to search for JPG files only?

2) How can the gallery block be set to look for the latest (as opposed to random) JPG photos posted to the gallery?

Thanks in advance

Martin
Title: Re: Gallery Block for my phpBB portal
Post by: vuud on December 31, 2006, 04:51:26 pm
The gallery block code that I am using on this site - www.ukmartin.com/phpbb2 is this:

A question in two parts follows from this:

1) Coppermine (in ../gallery ) has some multimedia files on display. These pose the gallery block a problem with displaying the thumbnails. Can the script introduce a filter to search for JPG files only?

2) How can the gallery block be set to look for the latest (as opposed to random) JPG photos posted to the gallery?



cpmFetch has features to do both of these.  It would reduce the lines of code above to a small handful.

See the CPG 1.4 Support area for the cpmfetch forum

Vuud
Title: Re: Gallery Block for my phpBB portal
Post by: uk_martin on December 31, 2006, 06:55:10 pm
Thankd Vuud

I've installed the latest "Stable" version (1.6.4 ?)

Only problem is...how do I get the 5 thumbnails here - http://www.ukmartin.com/phpbb2/portal.php  to be spread evenly across the block instead of being bunched in the middle of a "centered" single cell? The "old" code had a 5-celled table, with each cell being 20% of the width of the table and containing one pic per cell which made for a neat look.

How can I configure cpmfetch to replicate this look?

Thanks

Martin
Title: Re: Gallery Block for my phpBB portal
Post by: Joachim Müller on January 02, 2007, 07:25:36 am
cpmFetch-related questions mustn't go into this very thread that deals with yet another mod. Vuud told you were to post your question already ::)
Title: Re: Gallery Block for my phpBB portal
Post by: helitown on February 13, 2007, 07:07:11 am
Hmmm....I am trying to read this thread word by word to see if I can put these codes together and change it to get cpmfetch on my IMPortal here www.helitown.com/portal.php either in the center or left bar. I use 1.6.4, PhpBB 2.0.21 and IMPortal 1.2.0. I appreciate any help.
Title: Re: Gallery Block for my phpBB portal
Post by: helitown on February 13, 2007, 07:11:29 am
Sorry - I posted the wrong link and I can't edit my own post. http://www.helitown.com/forum/portal.php
Title: Re: Gallery Block for my phpBB portal
Post by: Joachim Müller on February 13, 2007, 08:05:30 am
This thread does not deal with cpmFetch - just read the posting above yours! If you need support for cpmFetch, go to the proper support board! >:(