Results 1 to 4 of 4

Thread: help please. Full Screen Image Slideshow (w/ auto read images from directory)

  1. #1
    Join Date
    Apr 2016
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help please. Full Screen Image Slideshow (w/ auto read images from directory)

    I hope someone can help me. I new to js but vet with html.

    I have been trying to use this [I though] simple js from here.
    http://javascriptkit.com/script/scri...ow/index.shtml

    I have followed the instructions to the letter for what feels like hundreds of times. Yet it never works!

    I tried it on two different servers and always the same thing. their demo works when you link the demo.htm to their fpslidershowvar.php but not mine.

    I have debugged via firefox brower and it shows that it's finding my fpslidershowvar.php but it never gets a response back


    from browser debug:

    GET http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js [HTTP/1.1 200 OK 0ms]
    GET http://10.168.201.52/pictures/fpslideshowvar.php [HTTP/1.1 200 OK 16ms]
    GET http://10.168.201.52/fpslideshow.js [HTTP/1.1 200 OK 16ms]
    SyntaxError: expected expression, got '<' fpslideshow.js:137
    ReferenceError: fpslideshowvar is not defined fpslideshow.js:137:2

    The demo works but the code provided doesn't .

    Can someone please try it and let me know if the code provided is faulty.

    I'm honestly not good enough with js yet to just look at it and see if it has a period or a coma out of place some where.

    I'm currently trying to run this on raspberry pi using apache2 and php5. But i have also tested it on my godaddy server and it does the exact same thing.

    Ive been beating my head against a wall here for a week and just can't see what has to be obviously wrong.


    Thank you for you help!
    Sobiguy
    Last edited by sobiguy; 04-21-2016 at 03:26 AM. Reason: format

  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

    Now of course you can only do this on a PHP enabled server that has certain file and directory functions enabled. That said, I also see that the supplied fpslideshowvar.php file has at least two potential problems (no formal opening php tag, and uses a deprecated method - eregi). Try this version:

    PHP Code:
    <?php
    Header
    ("content-type: application/x-javascript");

    function 
    returnimages($dirname=".") {
       
    $pattern="/\.(jpg|jpeg|png|gif|bmp)$/i";
       
    $files = array();
       
    $curimage=0;
       if(
    $handle opendir($dirname)) {
           while(
    false !== ($file readdir($handle))){
                   if(
    preg_match($pattern$file)){
             
    $filedate=date ("M d, Y H:i:s"filemtime($file));
                     echo 
    "        [$curimage, \"$file\", \"$filedate\"],\n";
                     
    $curimage++;
                   }
           }
           echo 
    "        [\"placeholder\"]\n";
           
    closedir($handle);
       }
       return(
    $files);
    }

    echo 
    "var fpslideshowvar={\n";
    echo 
    "    baseurl: \"http://" $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
    echo 
    "    images: [\n";
    returnimages();
    echo 
    "    ],\n";
    echo 
    "    desc: []\n";
    echo 
    "}\n";
    ?>
    If you want more help, please supply a link to the page on your site that has the problematic code.
    - John
    ________________________

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

  3. #3
    Join Date
    Apr 2016
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @jscheuer1

    You Sir have my greatest amount of gratitude and admiration! x1000 That did the trick perfectly.
    I knew it had to be staring me in the face. I didn't want to just ask for help till I thought i had tried everything short of JS classes to figure it out.

    Thank you again.

    Sobiguy

  4. #4
    Join Date
    Oct 2010
    Posts
    29
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    I changed it from eregi to preg_match, but I noticed on Chrome and Edge it puts the left half of the photos on the right side. So, the left half of the screen is black and the right half has half the photo shown. In Opera and Firefox, it is centered. However, when I look at the sample, it is centered. It used to be centered until I upgraded my php version. I corrected from eregi to preg_match, as stated above, and it still is uncentered on those two browsers. I really did not think I changed anything from the sample except for changing to my images. Any ideas?

Similar Threads

  1. Replies: 3
    Last Post: 12-11-2015, 04:07 PM
  2. Replies: 6
    Last Post: 01-23-2015, 11:54 AM
  3. Replies: 4
    Last Post: 02-25-2014, 06:11 PM
  4. Looking for multi-functional slideshow - full screen, customizable appearance, etc.
    By tnd1000 in forum Looking for such a script or service
    Replies: 8
    Last Post: 10-19-2012, 10:41 PM
  5. Auto Full Screen Window Opener
    By nytrade4u in forum JavaScript
    Replies: 1
    Last Post: 10-10-2009, 10:32 AM

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
  •