Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Ultimate Fade In Slideshow

  1. #1
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ultimate Fade In Slideshow

    Can anyone show me what modifications to make to this script:

    http://www.dynamicdrive.com/dynamici...nslideshow.htm

    So that it preloads ALL the images in a given directory before playing them in two windows.


    Thanks in advance very much!

    Nelson

  2. #2
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Is there another script that will use PHP or something to fetch all the images in a given directory that I can combine with the ultimate fade in slideshow code to allow an entire directory of images to be loaded without specifying a number of photos?

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This script still doesn't work for me with FX... anyway.
    Code:
    <?php
    // getpics.php
    $directory = "images"; // Directory in which the images are stored, relative to the location of this script.  Must have the slash.
    
    header("Content-Type: text/javascript");
    $dir = opendir($directory);
    while($file = readdir($dir))
      if(strpos($file, ".") === 0) continue;
      else echo("fadeimages[0]=['$directory/$file', '', ''];\n");
    ?>
    Where you would normally have the array values:
    Code:
    </script><script src="getpics.php" type="text/javascript"></script><script>
    Make sure getpics.php is in the same directory as the page containing the script, and change the $directory variable to point to the directory.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much! I shall try that out!

    Nelson

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Made a slight error. Should be:
    Code:
    <?php
    // getpics.php
    $directory = "images"; // Directory in which the images are stored, relative to the location of this script.  Must have the slash.
    
    header("Content-Type: text/javascript");
    $dir = opendir($directory);
    for($i=0;$file = readdir($dir);$i++)
      if(strpos($file, ".") === 0) continue;
      else echo("fadeimages[$i]=['$directory/$file', '', ''];\n");
    ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please forgive my stupidity, but I did something wrong.

    I placed your code in a PHP file - getpics2.php (I already had a getpics from the photo album script). I changed the directory link to "/Graphics" where I store the files, and I added the line of invocation where the array definitions were. (see below), and I am getting error messages. What did I do wrong? Thanks.

    <script type="text/javascript">
    /***********************************************
    * Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for this script and 100s more.
    ***********************************************/

    </script><script src="getpics2.php" type="text/javascript"></script><script>

    ////NO need to edit beyond here/////////////

    var fadearray=new Array() //array to cache fadeshow instances
    var fadeclear=new Array() //array to cache corresponding clearinterval pointers

    var dom=(document.getElementById) //modern dom browsers
    var iebrowser=document.all

    function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
    this.pausecheck=pause
    this.mouseovercheck=0
    this.delay=delay
    this.degree=10 //initial opacity degree (10%)
    this.curimageindex=0
    this.nextimageindex=1
    fadearray[fadearray.length]=this
    this.slideshowid=fadearray.length-1
    this.canvasbase="canvas"+this.slideshowid
    this.curcanvas=this.canvasbase+"_0"
    if (typeof displayorder!="undefined")
    theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter)
    this.theimages=theimages
    this.imageborder=parseInt(borderwidth)
    this.postimages=new Array() //preload images
    for (p=0;p<theimages.length;p++){
    this.postimages[p]=new Image()
    this.postimages[p].src=theimages[p][0]
    }

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It needs to be relative to the script, because / is a different place from the points of view of the script and the browser.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm still getting a syntax error and an error that fadeimages1 and 2 are undefined.

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    May we see your page?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    http://www.protestantlawyersny.org/test.htm

    is the test page I made.

    and the getpics2.php script is:

    <?php
    // getpics.php
    $directory = "Graphics/Thumbnails/"; // Directory in which the images are stored, relative to the location of this script. Must have the slash.

    header("Content-Type: text/javascript");
    $dir = opendir($directory);
    for($i=0;$file = readdir($dir);$i++)
    if(strpos($file, ".") === 0) continue;
    else echo("fadeimages[$i]=['$directory/$file', '', ''];\n");
    ?>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •