Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: Ultimate Fade-in slideshow (v1.5) Request

  1. #1
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Ultimate Fade-in slideshow (v1.5) Request

    1) Script Title: Ultimate Fade-in slideshow (v1.5)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nslideshow.htm

    3) Describe problem:

    Hi,

    I'm new here, I hope you can help. I love this script.

    Is there a way to have the JS select all of the photos from a folder and display them in the slideshow without having to type in each of the paths.

    I have a large folder of images that continually are updated and changing (adding some each month, deleting others, etc). I do not want to have to modify the script every time I update my photos. I would prefer to have the js take all of the images and just loop thru the entire sequence. I do not need to add links to any of the photos but I do need to control the output size of the photos.

    I would greatly appreciate a reply.

    Thank you.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes but, the images and the linked pages (if any) would need to be represented by names in a numbered sequence.

    Say you had a directory called 'images' with ten images in it numbered 0.jpg to 9.jpg, you could do this:

    Code:
    var fadeimages=new Array();
    for (var i_tem = 0; i_tem < 10; i_tem++)
    fadeimages[i_tem]=["images/"+i_tem+".jpg", "", ""] //plain image syntax
    Beyond that, you would need to have a server side language. Currently (as far as I know) only PHP and asp/VBscript methods have been worked out for this (pulling a list of images and/or files from a directory). For this slide show script, some modifications would need to be done to one of these server side scripts and using links with the images in the slide show (if desired) would make things more complicated.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Well, this script manages it without a server side language. It relies on XMLHTTPRequest though. It may be able to be used as a base.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by blm126
    Well, this script manages it without a server side language. It relies on XMLHTTPRequest though. It may be able to be used as a base.
    Totally dysfunctional in Opera and probably others. The problem (from the thread you mention) about load times would be lessened by using smaller images and (if possible) preloading.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool continuous loop vbs script

    Hello,
    Sorry, I have away from my computer this afternoon. Thank you for your reply's. I have found this vbs script (attached) and have made it work except that I do not know how to make it.

    Can you help?

    Thank you again!

  6. #6
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry, make it loop?

  7. #7
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you can't tell, I'm a newbee. Here's the vbs script...

    Option Explicit

    ' slideshow delay in milliseconds
    Const lngDelay = 5000

    ' valid file extensions for slides
    Const strValid = ".jpg.jpeg.gif.png"

    ' output file name
    Const strFileName = "slideshow.htm"

    ' ******************** DO NOT MODIFY BELOW THIS LINE ********************

    ' Define variables.
    Dim objFSO
    Dim objOutput
    Dim strImage
    Dim strExt
    Dim strFirst
    Dim lngCount
    Dim objFolder
    Dim objFile

    ' Create the output file.
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objOutput = objFSO.CreateTextFile(strFileName)

    ' Output the page header and beginning of slideshow script.
    objOutput.WriteLine "<html>" & vbCrLf & "<head>"
    objOutput.WriteLine "<script language=""javascript"">" & vbCrLf & "<!--"
    objOutput.WriteLine "function PreloadImage(tmpSImage)"
    objOutput.WriteLine "{"
    objOutput.WriteLine vbTab & "var tmpOImage=new Image();"
    objOutput.WriteLine vbTab & "tmpOImage.src=tmpSImage;"
    objOutput.WriteLine vbTab & "return tmpOImage;"
    objOutput.WriteLine "}"
    objOutput.WriteLine "var strImage = new Array("

    ' Get a folder object from the current to parse for files.
    Set objFolder = objFSO.GetFolder(".")

    ' Loop through the files in the folder.
    For Each objFile In objFolder.Files
    ' Does the file have an extension?
    If InStr(objFile.Name,".") Then
    strImage = objFile.Name
    ' Get the file name extension.
    strExt = LCase(Mid(strImage,InStrRev(strImage,".")))
    ' Is the extension a valid extension?
    If InStr(strValid,strExt) Then
    ' Output the code to load the image.
    objOutput.Write "'" & strImage & "',"
    If Len(strFirst) = 0 Then strFirst = strImage
    lngCount = lngCount + 1
    End If
    End If
    Next
    objOutput.WriteLine "''" & vbCrLf & ");"

    ' Output the rest of the slideshow script.
    With objOutput
    .WriteLine "var objImage = new Array(strImage.length-2);"
    .WriteLine "var lngCount = strImage.length - 1;"
    .WriteLine "function LoadImages()"
    .WriteLine "{"
    .WriteLine vbTab & "if (lngCount >= 0)"
    .WriteLine vbTab & "{"
    .WriteLine vbTab & vbTab & "document.all['theSPN'].innerHTML=lngCount;"
    .WriteLine vbTab & vbTab & "objImage[lngCount] = PreloadImage(strImage[lngCount]);"
    .WriteLine vbTab & vbTab & "lngCount--;"
    .WriteLine vbTab & vbTab & "setTimeout('LoadImages()', 50);"
    .WriteLine vbTab & "}"
    .WriteLine vbTab & "else"
    .WriteLine vbTab & "{"
    .WriteLine vbTab & vbTab & "lngCount = 0;"
    .WriteLine vbTab & vbTab & "document.all['theDIV'].innerHTML='<img src=""" & strFirst & """ id=""theIMG"">';"
    .WriteLine vbTab & vbTab & "setTimeout('SwapImage()'," & lngDelay & ");"
    .WriteLine vbTab & "}"
    .WriteLine "}"
    .WriteLine "function SwapImage()"
    .WriteLine "{"
    .WriteLine vbTab & "++lngCount;"
    .WriteLine vbTab & "if (lngCount<strImage.length-1)"
    .WriteLine vbTab & "{"
    .WriteLine vbTab & vbTab & "document.all['theIMG'].src=objImage[lngCount].src;"
    .WriteLine vbTab & vbTab & "setTimeout('SwapImage()'," & lngDelay & ");"
    .WriteLine vbTab & "}"
    .WriteLine "}"
    .WriteLine "//-->" & vbCrLf & "</script>"
    .WriteLine "</head>" & vbCrLf & "<body onLoad=""setTimeout('LoadImages()'," & lngDelay / 1000 & ");"">"
    .WriteLine "<div align=""left"" id=""theDIV"" style=""width: 250px; width: 250px; text-align:center; border:solid 2px #000;""><p>Please wait...<br>"
    .WriteLine "Loading " & lngCount & " images...<br>(<span id=""theSPN"">0</span>)</p></div>"
    .WriteLine "</body>" & vbCrLf & "</html>"
    End With

    ' Close the output file.
    objOutput.Close

  8. #8
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here's the html & js that the vbs produces...

    <html>
    <head>
    <script language="javascript">
    <!--
    function PreloadImage(tmpSImage)
    {
    var tmpOImage=new Image();
    tmpOImage.src=tmpSImage;
    return tmpOImage;
    }
    var strImage = new Array(
    'amethyst checkerboard trill- 14mm- 7.jpg','aquamarine gem trill- 13mm- 7.jpg','burma ruby 5mm trill pair- 1.jpg','cambodian blue zircon oval- 12.jpg','ceylon cushion blue sapphire- 5.jpg','color change burma spinel- 2.jpg','emerald 9mm trill- 1.jpg','gem 10x12mm oval peridot- 4.jpg','german cut fancy citrine- 11.jpg','imperial topaz 9mm trill- 2.jpg','multi-color tahitian strand- 9-12mm framed.jpg','nigerian blue-green 9mm tourmaline- 2.jpg','pink tourmaline trill pair- 5811- 1.jpg','princess ceylon blue sapphire- 4.jpg','sri lankan rhodolite garnet-10x12mm- 5.jpg','tanzanite 10.jpg','trill ceylon blue sapphire- 4mm pair- .jpg',''
    );
    var objImage = new Array(strImage.length-2);
    var lngCount = strImage.length - 1;
    function LoadImages()
    {
    if (lngCount >= 0)
    {
    document.all['theSPN'].innerHTML=lngCount;
    objImage[lngCount] = PreloadImage(strImage[lngCount]);
    lngCount--;
    setTimeout('LoadImages()', 50);
    }
    else
    {
    lngCount = 0;
    document.all['theDIV'].innerHTML='<img src="amethyst checkerboard trill- 14mm- 7.jpg" id="theIMG">';
    setTimeout('SwapImage()',5000);
    }
    }
    function SwapImage()
    {
    ++lngCount;
    if (lngCount<strImage.length-1)
    {
    document.all['theIMG'].src=objImage[lngCount].src;
    setTimeout('SwapImage()',5000);
    }
    }
    //-->
    </script>
    </head>
    <body onLoad="setTimeout('LoadImages()',5);">
    <div align="left" id="theDIV" style="width: 250px; width: 250px; text-align:center; border:solid 2px #000;"><p>Please wait...<br>
    Loading 17 images...<br>(<span id="theSPN">0</span>)</p></div>
    </body>
    </html>

  9. #9
    Join Date
    Aug 2006
    Location
    Oregon
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can something like this be used with your js so that the images will also fade.

  10. #10
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Yes, but I don't think anyone here knows ASP(That is what the file you posted is). If you can also use PHP, I would be able to help.

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
  •