PDA


View Full Version : crandom


Liquid_N2
12-27-2005, 08:42 PM
Since upgrading vb from 3.0.8 to 3.5.2 the crandom module doesnt appear to display any images.

crandom.php says:

<?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('*******', '*******', '*******'); //***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 to match your coppermine database name
//@mysql_select_db('forum')//
if (! @mysql_select_db('*******') ) {
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
//change this to match your coppermine table prefix
//change the limit 0,5 is good for the center block and default thumbnail size//
$MZresult = @mysql_query("SELECT * FROM cpg134_pictures ORDER BY RAND() LIMIT 0,5");
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
// you cna adjust the thumbnail sizes by changing the with and height//
//the default is set to border=0 width=60 height=50 //
//based on the center block size//
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;&nbsp;'); //outputs path from /userspics
}

//This displays the picture's album name and
//links it to the coppermine album
//change this to match your coppermine table prefix
$MZalbumresult = @mysql_query("SELECT * FROM cpg134_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>');
}
// change line below to match your galley database name//
if (! @mysql_select_db('**********') ) {
die( '<p>Unable to reload the main website ' .
'database at this time.</p>' );
}

?>


phpinclude_start says:


// Example of how to include a seperate file:
// ob_start();
// require("yourheader.html");
// $header = ob_get_contents();
// ob_end_clean();

//random images from coppermine//
$randomimg = implode("", file("http://www.hopelessheroes.co.uk/gallery/crandom.php"));
//end of random images from coppermine//

if ($bbuserinfo['field5'] == 'Left')
{
$vboptions['legacypostbit'] = 1;
}

if ($bbuserinfo['field5'] == 'Top')
{
$vboptions['legacypostbit'] = 0;
}


Does anyone else have this issue or know how to resolve it?

The gallery is linking fine to vb database, its just the random images not displaying.

Thanks in advance.

KW802
12-27-2005, 09:05 PM
You'd be best off posting this in the thread that deals with the module.