1.44 build 177
Please rate DAlbum at HotScripts.com
Please rate DAlbum at @ PHP-Resource.de
Rate DAlbum @ The PHP Resource Index
Script Rating:
Slide show   

The purpose of this sample is add slide show capabilities with user-selected time interval.

Please check demo for an example.

If you don't feel like patching configuration files yourself, download and install already patched set of templates from here.

Instructions

1. Edit your t_showimg.php page template and replace the line

  <body class="nomargins" onload="javascript: dalbum_onload();" >

with

  <body class="nomargins" onload="javascript: dalbum_onload();_slideshow();" >

2. Go to the end of t_showimg.php page template and insert the following code snippet before the last '//-->':

      <!-- Begin slideshow code -->
    function _slideshow()
    {
<?php     $nSlideShow=0;
        if (isset(
$_GET['slideshow']))
            
$nSlideShow=$_GET['slideshow'];
        if (
$nSlideShow>0)
        {
            
// Change 5 here to minimal allowed interval in seconds
            
if ($nSlideShow<5)
                
$nSlideShow=5;
            
$url=$next;
            if (empty(
$url))
            {
                
// !!! Uncomment the next line enable slide show looping
                // $url=$first;
            
}
            if (!empty(
$url))
            {
                
$delay=$nSlideShow*1000;
                
$url.="&slideshow=" $nSlideShow;
                print 
"window.setTimeout(\"window.location.replace('$url');\",$delay);";
            }
        }
?>
    }

    function onSlideshowChange(combo)
    {
        var u=window.location.href;
        var n=u.indexOf('&slideshow');
        if (n!=-1)
            u=u.substr(0,n);

        if (combo.selectedIndex>0)
            u+="&slideshow=" + combo.options[combo.selectedIndex].value;

        window.location.replace(u);
        return true;
    }
    <!-- End slideshow code -->

3. Edit your custom.php and find and uncomment customGetButton function. Replace its body with the following code snippet:

 // localization strings (may be added to standard distribution later)
if (!isset($lang['cSlideshowSlideshow']))
{
    
$lang['cSlideshowSlideshow']='-- Slide show --';
    
$lang['cSlideshowSeconds']  ='#sec# seconds';
}

function 
customGetButton($id$href$text$title$nSpacer$target)
{
    
$ret="";

    
// Display slideshow combo before 'fullscreen' button
    // and only on showimg.php page
    
if (($id=='fullscreen'||$id=='closewindow') && stristr($_SERVER['PHP_SELF'],"showimg"))
    {
        
// Add a little space before the combo
        
$ret '<span id="space_slideshow" class="buttonspace">&nbsp;&nbsp;&nbsp;</span>';

        
// Localize Slideshow: string here
        
$ret.= '<span class="slideshow">';
        
$ret.= '<form onsubmit="">';
        
$ret.= "<select onchange='onSlideshowChange(this);'>";

        
// Number of seconds/slide to be displayed in the combo-box.
        
$seconds=array(0,5,10,30,60);

        
$def=0;
        if (isset(
$_GET['slideshow']))
            
$def=$_GET['slideshow'];

        foreach (
$seconds as $s)
        {
            
$ret.="<option value=\"$s\"";
            if (
$s==$def)
                
$ret.=" selected";
            
$ret.=">";

            global 
$lang;
            if (
$s==0)
                
$ret.=$lang['cSlideshowSlideshow'];
            else
                
$ret.=strtr($lang['cSlideshowSeconds'],array("#sec#"=>$s));
            
$ret.="</option>";
        }
        
$ret.='</select></form>';
        
$ret.='</span>';

    }
    
// if we are in slideshow mode already - do not display "Fullscreen"
    
if ($id=='fullscreen' &&
        
stristr($_SERVER['PHP_SELF'],"showimg") &&
        isset(
$_GET['slideshow']))
        return 
$ret;

    
$ret.=getButton($id,$href,$text,$title,$nSpacer,$target,false);
    return 
$ret;
}

4. Edit your custom.css and append the following lines to the file:

  /* Add your custom styles here */

/* Add your custom styles here */
.slideshow form
{
    display: inline;
    vertical-align: middle;
}

.slideshow form select
{
/* You may want to uncomment code below and modify it to match to your stylesheet.

/* These settings are for main_normal.css. */
/*
    font-family:    Verdana, Arial, sans-serif;
    font-size:100%;
    color: black;
    background-color:    #E4E0D2;*/

/* These settings are for main_cyan.css */
/*
    font-family:    Verdana, Arial, sans-serif;
    font-size:100%;
    color: white;
    font-weight:     bold;
    background-color:   #064E80;
*/


/* These settings are for main_blue.css. */
/*
    font-weight:     bold;
    font-size:100%;
    color: white;
    background-color:#336699;
*/

/* These settings are for main_gray.css. */
/*
    font-family:    Tahoma, Verdana, Arial, sans-serif;
    color: #339;
    background-color:   #e6e6e6;
    font-size:100%;
*/
}

Edit the stylesheet above to uncomment or insert colors matching your stylesheet.

5. That's all. Modify the code above as needed.