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

04-21-2016, 12:05 AM
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.

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/1.1 200 OK 16ms]
GET [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!

04-21-2016, 12:32 AM
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:

Header("content-type: application/x-javascript");

function returnimages($dirname=".") {
$files = array();
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";
echo " [\"placeholder\"]\n";

echo "var fpslideshowvar={\n";
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
echo " images: [\n";
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.

04-21-2016, 02:22 AM

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.