Hi,
Here again an another random image mod ..
. This mod is different from the other random image mods in the following ways..
1. It uses a .swf file to show the random images.
2. Image transition happens in couple of nice effects.
3. All the play and pause control appears inside the .swf player, so, it will save some space on your website .
4. If you want you can view the random images on full screen also.
Well.. now starts the steps..
Step 1 : 1.1. Download the attached imagerotator.swf and swfobject.js file. ( unzip the imagerotator.zip file)
Step 2 : 2.1 In the below code change all
www.yourdomain.com to your actual domain name and save it as
xml.php.
<?php
header("Content-type: text/xml; charset=utf-8");
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: xml.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.x *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// NUMBER OF IMAGES TO DISPLAY
$num_images = 10;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
ORDER BY RAND()
LIMIT $num_images";
$result = $site_db->query($sql);
echo "<?xml version='1.0' encoding='UTF-8'?>\n";
echo "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n";
echo " <trackList>\n";
while ($row = $site_db->fetch_array($result)){
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : MEDIA_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo " <track>\n";
echo " <title>$image_name</title>\n";
echo " <creator>www.yourdomain.com</creator>\n";
echo " <location>http://www.yourdomain.com/$thumb_src</location>\n";
echo " <info>http://www.yourdomain.com/details.php?image_id=$image_id</info>\n";
echo " </track>\n\n\n";
}
echo " </trackList>\n";
echo "</playlist>\n";
?>
Step 3 : 3.1 Now upload all three files into your root folder.
3.2 Open your templates/your-folder/
home.html file and place the following code to show the random images.. Change the www.yourdomain.com with your actual domain name.
<div id="container">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this rotator.
</div>
<script type="text/javascript" src="./swfobject.js"></script>
<script type="text/javascript">
var s1 = new SWFObject("./imagerotator.swf","rotator","336","280","9");
s1.addVariable("file","http://www.yourdomain.com/xml.php");
s1.addVariable("width","340");
s1.addVariable("height","280");
s1.addVariable("backcolor","0x000000");
s1.addVariable("screencolor","0xFFFFFF");
s1.addVariable("overstretch","none");
s1.addVariable("usefullscreen","false");
s1.write("container");
</script>
All the variable are mentioned in the above code are self explanatory.. You can change those as per your requirement.
For more variable details you can follow this url ==>
http://developer.longtailvideo.com/trac/wiki/ImageRotatorVarsDemo :
bhwallpapers.comNow you are done..
Thanks,
batu544