Gallery Block for my SMF site Gallery Block for my SMF site
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Gallery Block for my SMF site

Started by DaMysterious, July 06, 2004, 02:24:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DaMysterious

As on my phpBB site, I like to have such a block for my SMF site. After changing the by me reworked code from Zarsky I stuck on displaying the thumbnails even when I change the albumpath to the right direction. They are'nt coming up as you could see on my SMF site. I have to mention that the second gallery on my SMF (test till ready) site is using the filebase from my first gallery on the phpBB site. Both of them uses different databases but they are daily synchronized to have the same contend as far as needed.

Fruther, how can I force the popup description (see the code) displaying the contend row bij row and not in one line with overflow.

Everythings works wel except the thumbs. Below the used code, maybe somone can shine a light on it. I don't see it anymore.


<?php 

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

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

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

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

if (!$MZnewfile) {   
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('smf') ) { 
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 cpg_pictures WHERE approved='YES' ORDER BY pid DESC LIMIT 0,4");   
if (!
$MZresult) {   
die(
'<p>Error performing query: ' mysql_error() . '</p>');   
}   

while ( 
$MZrow mysql_fetch_array($MZresult) ) {   

$ThumbnailSizeMax=100;

if ((
$ThumbnailSizeMax>0) and ($MZrow['pwidth']<>0) and ($MZrow['pheight']<>0)) { // prevent "division by 0" error
if ($MZrow['pwidth']>$MZrow['pheight']){ //so thumbnail width will also be bigger than the thumbnail height

$ThumbnailSizeWidth=$ThumbnailSizeMax; // since WIDTH>HEIGHT we can set ThumbWidth to it's Maximum
$ThumbnailFactor$MZrow['pwidth'] / $ThumbnailSizeMax// get the factor by which the thumb has been made smaller
$ThumbnailSizeHeight=round(($MZrow['pheight'] / $ThumbnailFactor),0); // calculate new Thumbnail height, make it an integer (remove values after decimal point)
 
} elseif ($MZrow['pheight']>$MZrow['pwidth']){ //so thumbnail HEIGHT will also be bigger than the thumbnail width

$ThumbnailSizeHeight=$ThumbnailSizeMax; // since HEIGHT>WIDTH we can set ThumbHeight to it's Maximum
$ThumbnailFactor$MZrow['pheight'] / $ThumbnailSizeMax// get the factor by which the thumb has been made smaller
$ThumbnailSizeWidth=round(($MZrow['pwidth'] / $ThumbnailFactor),0); // calculate new Thumbnail width, make it an integer (remove values after decimal point)

} elseif ($MZrow['pheight']=$MZrow['pwidth']){ //so thumbnail HEIGHT will also be bigger than the thumbnail width

$ThumbnailSizeHeight=$ThumbnailSizeMax; // since HEIGHT=WIDTH we can set ThumbHeight & ThumbWidth to it's Maximum
$ThumbnailSizeWidth=$ThumbnailSizeMax; // since HEIGHT=WIDTH we can set ThumbHeight & ThumbWidth to it's Maximum

}
}

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

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

echo('<center> <img src="' $copperminepath '/albums/');         //append base dir structure 
echo(
$MZrow['filepath'].thumb_.$MZrow['filename'] . 
     '" alt="Filename: ' $MZrow['filename'] .      // set ALT attribute
     '" title="' $MZrow['title'] . - // set TITLE attribute
     ', description: ' $MZrow['caption'] .  // put description of picture in TITLE attribute
     ', uploaded from: ' $MZrow['owner_name'] .  // put uploader of picture in TITLE attribute
     ', wxh: ' $MZrow['pwidth'] . // put width of picture in TITLE attribute
     'x' $MZrow['pheight'] .       // put height of picture in TITLE attribute
     ', keywords: ' $MZrow['keywords'] . // put keywords of picture in TITLE attribute
     ', ' $MZrow['hits'] . 'x viewed' . // put views of picture in TITLE attribute
     ', ' $MZrow['votes'] . ' ratings' . // put number of votes on picture in TITLE attribute
     ', average ratings ' round(($MZrow['pic_rating']/2000),2) .  // put average voting of picture in TITLE attribute
     '" height="' .$ThumbnailSizeHeight.'px' . // set HEIGHT attribute
     '" width="' .$ThumbnailSizeWidth.'px' . // set WIDTH attribute
     '" border="0" /> </center>' '</a>'."\n");  // outputs path from /userspics  // close IMG tag, center and A tag
}   


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

?>

DaMysterious.

DaMysterious

I'd solve one of my questions. There whas a little glitch in this code

Search for:

$MZrow['filepath'].thumb_.$MZrow['filename'] .


and change into:

$MZrow['filepath'].$MZrow['filename'] .


Take a look here.
DaMysterious.

kegobeer

I posted a ssi.php mod to display the latest pictures over at the SMF forums.  I also have it for download on my site, if you're interested.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

DaMysterious

Quote from: kegobeer on July 07, 2004, 05:13:38 PM
I posted a ssi.php mod to display the latest pictures over at the SMF forums.  I also have it for download on my site, if you're interested.

Looks cool. I give it a try. Tanks!
DaMysterious.

nameless

DaMysterious how did you get your film strip to show vertical on your site? Thanks!

Joachim Müller


nameless

Quote from: GauGau on July 10, 2004, 08:40:05 PM
@nameless: don't try to hijack threads by posting unrelated questions; instead, search the board first: http://forum.coppermine-gallery.net/index.php?topic=7637.0 and http://forum.coppermine-gallery.net/index.php?topic=7126.msg34217#msg34217 [:|

GauGau

ack, sorry BOSS ;D I did a search but I put "vertical film strip". :-X

radianation

I'd like to modify this code a bit to display 5 random photo thumbnails uploaded by the user on their SMF profile with a link on each photo to visit their personal user gallery in coppermine. Any ideas?

uk_martin

#8
DaMysterious - firstly, well done on an excellent site!

I also want a Coppermine block on my phpBB2 Plus 1.52 portal page, only I want it to run vertically down the left hand side, just beteen the Index and the Search blocks, showiing 3 or 4 thumbnails of the last 3 - 4 pictures to be uploaded, max width 120px (the column is 150px already)

I assume that the code at the start of this thread is the PHP which lies behind the Coppermine block? Does this now need updating with the contribution from the others on this thread? Or has the ssi.php code replaced what you have created? Or is that all specific to another kind of Forum, and phpBB needs something else altogether?

What is the code for the portal_body_tpl file to insert this block?

Please excuse the very basic questions, but I can copy and paste what I'm told to copy and paste, but the coding in beyond my limited understanding. As you can see, some "idiot-proof" instructions would be very much appreciated.

By the way, I love the look of that Plugged Violet theme. Will it be a matching set for Coppermine AND phpBB2 Plus 1.52 when it is finished? I hope so and I look forward to being one of the first to use it.

Thanks in advance for any help you can give me to get the Coppermine block working.

Martin