Update: 25.01.2008vBulletin Version 3.6.8 and 4images 1.7.4 NOTE: this mod will work ONLY if your 4images mysql tables are in SAME DATABASE like vBulletin.
ACHTUNG: dieser mod funktioniert NUR wenn 4images mysql tabellen in GLEICHER DATENBANK sind wie die von vBulletin.
1.) open
öffne
vBulletin global.php (
not /
nicht admin/global.php)
search
suche
?>
add before
vordem füge dies
// START RANDOM PIC MOD
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: none *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* MOD for 4images 1.7.4 & vBulletin 3.6.8 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* 4images ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* 4images is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/4images/');
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
define('THUMB_DIR', 'data/thumbnails');
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT COUNT(*) AS total_images
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0";
$row = $db->query_first($sql);
$total_images = $row['total_images'];
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT 4images_images.image_id,4images_images.cat_id,4images_images.image_name,
4images_images.image_active,4images_images.image_thumb_file,4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
LIMIT $number, 1";
$row = $db->query_first($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont>\n";
// HAVE FUN
// END RANDOM PIC MOD
1.a) if you want to use it with more than one pic the use this code
wenn du es mit mehr bildern benutzen willst benutzen diesen code
// START RANDOM PIC MOD
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: none *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* MOD for 4images 1.7.4 & vBulletin 3.6.8 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* 4images ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* 4images is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/4images/');
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
define('THUMB_DIR', 'data/thumbnails');
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 3;
// In following query CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT 4images_images.image_id, 4images_images.cat_id, 4images_images.image_name,
4images_images.image_active, 4images_images.image_thumb_file, 4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
ORDER BY RAND()
LIMIT $num_images";
$result = $db->query($sql);
$randompic = "<table><tr>\n"; // START NEW TABLE
while ($row = $db->fetch_array($result)){
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic .= "<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" title=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont></td>\n";
}
$randompic .= "</tr></table>\n"; // END OF NEW TABLE
// HAVE FUN
// END RANDOM PIC MOD
2.) in mod self change
im mod selbst ändere
// Set here the URL to your 4images Gallery. WITH trailing slash!
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
3.) now you can use
$randompic in every VB template
jetzt kannst du
$randompic in jedem VB template benützen
3.a) if you want to have the random pic only on your vB main page, then put the code into index.php & template forumhome. (don't use it in global.php!)
wennst willst das zufallsbild nur auf der vB startseite erscheint, dann füge den code nur in der index.php & template forumhome. (benutze es dann nicht in der global.php!)
that's it.... have fun
das ist alles.... viel spass