4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: batu544 on June 03, 2010, 04:14:13 PM

Title: [MOD] Random image on home page with flash
Post by: batu544 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 (http://developer.longtailvideo.com/trac/wiki/ImageRotatorVars)


Demo : bhwallpapers.com (http://www.bhwallpapers.com/)



Now you are done.. :)


Thanks,
batu544
Title: Re: [MOD] Random iamge on home page with flash
Post by: mawenzi on June 04, 2010, 01:07:36 AM
... the flash looks nice and saves a lot of space in template design ...
... thanks for sharing ...
Title: Re: [MOD] Random image on home page with flash
Post by: kubiczek 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";
Title: Re: [MOD] Random image on home page with flash
Post by: batu544 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
Title: Re: [MOD] Random image on home page with flash
Post by: kubiczek 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.




Title: Re: [MOD] Random image on home page with flash
Post by: batu544 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
Title: Re: [MOD] Random image on home page with flash
Post by: kubiczek on June 08, 2010, 06:31:15 PM
Hallo Batu544

Work fine, Thanks.


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


Title: Re: [MOD] Random image on home page with flash
Post by: GaYan 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>
Title: Re: [MOD] Random image on home page with flash
Post by: batu544 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
Title: Re: [MOD] Random image on home page with flash
Post by: GaYan on June 10, 2010, 05:18:04 PM
tnx Man !

This post helped me alot  :D
Title: Re: [MOD] Random image on home page with flash
Post by: kemal 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
Title: Re: [MOD] Random image on home page with flash
Post by: Sunny C. on June 17, 2010, 12:37:28 PM
Added to: Mods Works Perfektly at 1.7.7 / Mods Laufen Perfekt mit 1.7.7 (http://www.4homepages.de/forum/index.php?topic=24888.0)
Title: Re: [MOD] Random image on home page with flash
Post by: zhono 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.
Title: Re: [MOD] Random image on home page with flash
Post by: Tino23 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 (http://developer.longtailvideo.com/trac/wiki/ImageRotatorVars)  
Title: Re: [MOD] Random image on home page with flash
Post by: Nosferatu 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
Title: Re: [MOD] Random image on home page with flash
Post by: x23piracy on November 16, 2010, 12:28:53 PM
Hi,

mit 1.7.9 spuckt die xml.php bei mir nur noch das hier aus:

Code: [Select]
  <?xml version="1.0" encoding="UTF-8" ?>
- <playlist version="1" xmlns="http://xspf.org/ns/0/">
  <trackList />
  </playlist>

keine Bilder die folge... Weiß jemand Rat?


Gruß Jens
Title: Re: [MOD] Random image on home page with flash
Post by: henary on December 10, 2010, 10:08:20 AM
Hello,

thanks for this MOD!

There are two things, that not fine at the moment:

If you use in xml.php and home.html "www.domain.com", the flash will don't work if the gallerie was visit by passing the "www" like http://domain.com/4images I tried to leave "www" in config-settings, but flash don't work anymore. At the moment the only solution may be to disable posibility of using http://domain.com/4images or make forwarding.

For the second i found a small solution for the moment by myself  :wink:

Because the selection of images is setting by
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
and there are none public pictures at all, but pitcures in categories with permission, nothing will displayed by flash  8O
My easy way:
in xml.php
search:
include(ROOT_PATH.'includes/constants.php');
add after
include(ROOT_PATH.'includes/auth.php');
search:
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
replace:
        WHERE a.image_active = 1 AND a.cat_id = b.cat_id AND b.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")

At the moment, this is not fine while guest will see flash images  :cry: and i don't nkow why. May it will be the best, flash images only shown for registered user.

Regards,
Henry
Title: Re: [MOD] Random image on home page with flash
Post by: x23piracy on December 10, 2010, 11:41:45 AM
Hi,

At the moment, this is not fine while guest will see flash images  :cry: and i don't nkow why. May it will be the best, flash images only shown for registered user.

use this surrounding tag:

Code: [Select]
{if user_loggedin}that what you only want to show loggedin users{endif user_loggedin}
for the xml try to use a relative path instead of an absolute:
Code: [Select]
s1.addVariable("file","./xml.php");(You may need to pimp the path, i don't know where your xml.php is stored)

Der Rotator ist aber nur zu empfehlen wenn du das Logo verschmerzen kannst.
Das ganze sieht auch nur schön aus wenn es groß genug ist das Logo ist sonst
über der betrefenden Grafik bis es ausgeblendet wird ;)

Falls du mal das Flash Dock benutzt bekommt man dort das Logo legal durch die
Settings quasi herausgeschoben aus dem sichtbaren Bereich...


Greetz X23
Title: Re: [MOD] Random image on home page with flash
Post by: henary on December 10, 2010, 11:54:30 AM
Hello X23,

thanks a lot! Now both working well  :mrgreen:

Regards,
Henry
Title: Re: [MOD] Random image on home page with flash
Post by: Nosferatu on June 02, 2011, 12:42:00 PM
Hallo,

work perfect with 1.7.10

Frage:
wie kann ich kategorien ausschließen?

Weiß das jemand ?

mein Code:
// 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 = 100;

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

Danke !

Mfg
Nosferatu

Title: Re: [MOD] Random image on home page with flash
Post by: Rembrandt on June 02, 2011, 01:03:54 PM
Nicht getestet.
damit du die kategorien in ACP unter einstellungen editieren kannst:

suche in der admin/settings.php:

show_table_separator($setting_group[3], 2, "setting_group_3");

und füge davor ein:

 //--------------------------------- Start cat select pic ---------------------------------
show_setting_row("cat_pic");
//--------------------------------- End cat select pic ---------------------------------


suche in lang/deutsch/admin.php:

$setting['num_subcats'] =

und füge davor ein:

//--------------------------------- Start cat select pic ---------------------------------
$setting['cat_pic'] = "Kategorie nicht Anzeigen:<br /><span class=\"smalltext\">ID Nummern mit , trennen.</span>";
//--------------------------------- End cat select pic ---------------------------------


in deinen code suche:
$num_images = 100;

darunter einfügen:
$cat_in= $config['cat_pic'];


in deine code suche:
WHERE a.image_active=1

danach einfügen:
AND a.cat_id NOT IN (".$cat_in.")


mfg Andi
Title: Re: [MOD] Random image on home page with flash
Post by: Nosferatu on June 02, 2011, 02:12:39 PM
danke!
Title: Re: [MOD] Random image on home page with flash
Post by: MrAndrew on August 31, 2011, 11:02:16 PM
Is it possible to remove "jwplayer" watermark?
Title: Re: [MOD] Random image on home page with flash
Post by: Rembrandt on September 01, 2011, 05:50:17 AM
Is it possible to remove "jwplayer" watermark?
yes: http://www.longtailvideo.com/order/
Title: Re: [MOD] Random image on home page with flash
Post by: Nosferatu on February 23, 2014, 03:06:39 PM
Gibts vom ImageRotator keine neue Version oder wurde dieser jetzt einfach in JWPlayer integriert, dieser wäre nämlich schon Version 6.8.

Hatte gehofft ich könnte da ein Upgrade machen.

LG
Jeff