<?php
// Random Gallery Image Block by SolidSnke at www.SolidSnke.com - version 1.1 - me@solidsnke.com
//
// This will take the pictures from your IP.Gallery mod and create a thumbnail and post it
// into a block or whatever your using. I use Unreal Portal and IP.CCS
// Thanks goes to Pascal Naidon for the vignette.php that makes the thumbnail possible.
//
// ** Disclaimer ** I suck at coding so if there is a better way, and I am sure there is
// please dont complain to me. I know this works for me, and as my little brain gets
// bigger maybe I will update this script.
//
// Installing: upload the vignette.php file to where you want, I put mine in the root folder
// to make things simple. If you do put it somewhere else then you will need to
// edit the echo like with the correct web address. Do not change what is after the
// ?f= part. That is it, if you should have questions please visit my website
// at http://www.solidsnke.com and check out the forums for help or to ask a question.
//
// Update 1.1: I made some changes to the PHP/mySQL coding and it appears to have fixed the imaging problems
// I was having where it was not showing all the pictures and galleries, and its a bit faster.
//
// Copyrights: all copyrights are held by there respectful owners, this script is my intellectual property
// but anyone is allowed to use and modify it as they see fit, but it cannot be sold without
// direct permission from the creator, which is me.
//
// dbConnect string (Server, username to db, userpassword to db)
$con = mysql_connect("localhost","root_username","root_password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
// Selecting the database to connect to
mysql_select_db("database", $con);
// this is the mySQL string used to pull from gallery_images (table name)
$offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM gallery_images ");
$offset_row = mysql_fetch_object( $offset_result );
$offset = $offset_row->offset;
$result = mysql_query( " SELECT * FROM gallery_images LIMIT $offset, 1 " );
while ($row = mysql_fetch_array($result)) {
// this is the string that will display the thumbnail picture into the block, using the vignette.php.
echo "<center><img src='http://www.yourwebsite.com/vignette.php?f=ipb/uploads/".$row['directory']."/".$row['masked_file_name']."'></center>";
}
mysql_close($con);
?>
Well I cannot upload a file here so if you want the vignette.php file you can hop over and pull it off my board at ==> http://solidsnke.com...om-image-block/

Cheers











