وظيفة الموديل : عرض صورة عشوائية من سكريبت البوم صور 4image مباشرة .
طريقة التجهيز :
في ملف global.php إبحث عن :
كود:
// 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 & vBulletin 2.2.7 *
* *
* 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_site->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,4ima ges_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_site->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 = "<center><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"><br /><br /><smallfont><b>$image_name</b></a><br />$image_comments Comments</smallfont></center>\n";
// HAVE FUN
// END RANDOM PIC MOD
قم بتصحيح المسارين في الكود أعلاه لمسار 4image في موقعك وحفظ الملف ورفعه مرة أخرى للمنتدى .
الآن قم بإستيراد الموديل المرفق من لوحة التحكم ثم الفي بي أدفانسد بورتال ثم إستيراد وتصدير ... إنتهى مع أجمل تحية .
0
مواقع النشر (المفضلة)