PDA

View Full Version : Rotating Images from a Directory


Butters
02-16-2009, 05:48 PM
Hi. I've been searching for JavaScript to rotate the main image on my home page every few seconds. My needs were:

-instead of listing every image path to the script, I want to be able to just add images to a directory, and have the script automatically rotate whatever is in that directory.

-i don't want to use php because i want to keep this page as the index.html page for search engines.

-Includes a 'noscript' plan if javascript isn't enabled.

I found a ton of scripts but they all satisfy two necessities but not the third. I just tried using the script at...

http://www.dreamweaverclub.com/forum/showthread.php?t=29012

...but then I realized that it only rotates on reload. I've tried adding lines like var delay = 3000 (I'm a photographer, not a programmer) but to no avail. Do someone know how to do this? It's easy to find PHP that will pull anything from a directory and rotate in a specified amount of time--but how about JavaScript?

Thanks.
Brandon

davidj
02-16-2009, 07:27 PM
you can do this in flash

domedia
02-16-2009, 10:02 PM
-i don't want to use php because i want to keep this page as the index.html page for search engines. Search Engines does not rank .html file extensions better or higher or anything. Fire the person that told you so. :-)

If you don't know JavaScript, consider using a framework like jQuery, which makes it easy for designers to use all kinds of great effects.

you can do this in flash You could probably do it with a Java applet as well, but nothing beats some unobtrusive JavaScript that degrades gracefully. 8-)

Butters
02-17-2009, 05:13 AM
It's not about the .html page type, it's about the fact that index.html is the root of the website, and index.php isn't. Although there isn't much on this page anyway, so it might not make much difference for me.

So I decided to make the .com (index.html) page redirect to a php page with a script I found that apparently uses php to extract the names of the files from a directory for javascript to swap. The script that fades them in and out nicely--but I can't get it to work for me. When I tried the page it just displayed all of the jpgs at once, and with no rotation.

http://www.linein.org/blog/2008/01/10/roate-image-using-jquery-with-plugin/

Oh well, I'll keep searching....

Wait...if I post the page contents, can someone tell me what I've done wrong?

davidj
02-17-2009, 06:44 PM
if you have copied the script 'as is' then on this line


<UL id=image_rotate style="LIST-STYLE-TYPE: none">
< ?= $image_rotation; ?> </SPAN>
</UL>


you need to remove the space between the first <?

it currently looks like this < ?

Im not saying it will fix it but it was obvious so thought id mention it

Butters
02-17-2009, 07:03 PM
Thanks, but I have it right. She must've fixed that in the text file.

Here is my page on the server:

www.caleventphoto.com/index.php

I don't want to use flash because I just want to be able to occasionally add more files to the server directory.

domedia
02-18-2009, 03:41 PM
Thanks, but I have it right. She must've fixed that in the text file. Who? Are you not developing this?
I don't want to use flash because I just want to be able to occasionally add more files to the server directory. There must be a misunderstanding. Flash slideshows will get their images from a directory just like a JavaScript slideshow will.

Butters
02-18-2009, 03:53 PM
"She" is the person that put up that PHP/jQuery script. But I read the name wrong--it is a "he".

Flash I'm fine with--in fact it's probably more compatible-- but I don't know how much I can develop it here. Although I do have the old Flash program on my Mac, I haven't opened it in years, and I don't even know if it will open since I've upgraded to Leopard.

I guess it can't be that hard--Is this something easy to learn in Flash for a non-developer? (not that I know anything about any other language).

domedia
02-18-2009, 04:54 PM
You can do slideshows in JS or Flash..
If you're not a developer, I would look into using a Javascript framework, like jQuery, and use one of their slideshow plugins. It's going to require *some* technical knowledge, but it's the path of least resistance afaik, :)