Author Topic: [MOD] Random image on home page with flash  (Read 42323 times)

0 Members and 1 Guest are viewing this topic.

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
[MOD] Random image on home page with flash
« on: June 03, 2010, 04:14:13 PM »
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.

Code: [Select]
<?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)) ? 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.

Code: [Select]
<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/ImageRotatorVars


Demo : bhwallpapers.com



Now you are done.. :)


Thanks,
batu544
« Last Edit: June 04, 2010, 03:07:44 PM by V@no »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Random iamge on home page with flash
« Reply #1 on: June 04, 2010, 01:07:36 AM »
... the flash looks nice and saves a lot of space in template design ...
... thanks for sharing ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline kubiczek

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • Gross Peterwitz
Re: [MOD] Random image on home page with flash
« Reply #2 on: June 04, 2010, 03:32:21 PM »
Hallo,

bei mir gehr die weiterleitung  zum details.php nicht, weiss jemand ein rat?

hier der auszug aus xml.php

Quote
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.grosspeterwitz.org/gp</creator>\n";
  echo "      <location>http://www.grosspeterwitz.org/gp/$thumb_src</location>\n";
  echo "      <info>http://www.grosspeterwitz.org/gp/details.php?image_id=$image_id</info>\n";
  echo "      </track>\n\n\n";
}
echo "   </trackList>\n";
echo "</playlist>\n";

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Random image on home page with flash
« Reply #3 on: June 04, 2010, 04:06:16 PM »
kubiczek,
                I didn't get your question exactly... ( I tried to translate also but no use.. :) )

Thanks,
batu544

Offline kubiczek

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • Gross Peterwitz
Re: [MOD] Random image on home page with flash
« Reply #4 on: June 04, 2010, 09:00:14 PM »
hallo Batu544

look down http://www.grosspeterwitz.org/gp/index.php

by klick on random  not follow to details site.





Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Random image on home page with flash
« Reply #5 on: June 04, 2010, 09:43:57 PM »
Hi kubiczek,


Add below two flashvars before     s1.write("container"); in your home.html


Code: [Select]
s1.addVariable("linkfromdisplay","true");
s1.addVariable("linktarget","_blank");



Thanks,
batu544

Offline kubiczek

  • Full Member
  • ***
  • Posts: 211
    • View Profile
    • Gross Peterwitz
Re: [MOD] Random image on home page with flash
« Reply #6 on: June 08, 2010, 06:31:15 PM »
Hallo Batu544

Work fine, Thanks.


top window 
Quote
s1.addVariable("linktarget","_top ");



Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] Random image on home page with flash
« Reply #7 on: June 09, 2010, 09:31:46 AM »
nice work batu  :D

I have a small prob though :( can we get the image and thumbnail seperatly ! ?

example xml ,

Code: [Select]
<image_source> ??? </image_source>
<thumb_source> ??? </thumb_source>
I'm Back :)

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Random image on home page with flash
« Reply #8 on: June 09, 2010, 02:39:41 PM »
Gayan,
           I think for this .swf file needs to be changed.. and I am not a swf file programmer.. :)  so, don't know what needs to be changed for this..

for more flashvars you can refer to the link which I have given in the original post..


Hope you can find some valuable things from there .. best of luck.. :)


thanks,
batu544

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] Random image on home page with flash
« Reply #9 on: June 10, 2010, 05:18:04 PM »
tnx Man !

This post helped me alot  :D
I'm Back :)

Offline kemal

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: [MOD] Random image on home page with flash
« Reply #10 on: June 13, 2010, 10:58:59 AM »
All the play and pause control appears inside the .swf player, so, it will save some space on your website
thanks good

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Random image on home page with flash
« Reply #12 on: June 29, 2010, 01:25:46 AM »
Great job, man. This one finally got my brain working enough for me to figure out how to create a new screensaver mod for my site.

Offline Tino23

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • LMJ - Motorsport
Re: [MOD] Random image on home page with flash
« Reply #13 on: July 27, 2010, 08:59:17 PM »
Wer die Navigationsanzeige nicht haben möchte verwendet im Schritt 3 einfach den Code hier, oder fügt einfach den Befehl
s1.addVariable("shownavigation","false"); zusätzlich ein.

Code: [Select]
<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.addVariable("linkfromdisplay","true");
s1.addVariable("linktarget","_top");
s1.addVariable("shownavigation","false");
s1.write("container");
</script>

Weitere Einstellmöglichkeiten findet ihr hier  
« Last Edit: July 31, 2010, 12:35:55 PM by Tino23 »

Offline Nosferatu

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Project-Firepower
Re: [MOD] Random image on home page with flash
« Reply #14 on: September 30, 2010, 04:41:47 PM »
wie kann ich das auf der haupt homepage verwenden?

Also www.domain.com/picgallerie/ -> is die bildergallerie

www.domain.com ist die haupt homepage

auf der möchte ich diese random pics laufen lassen.

thx 4 help