PDA

View Full Version : Show slides in order by date/time



breagan1
12-24-2008, 02:22 PM
1) Script Title: Swiss Army

2) Script URL (on DD): http://www.dynamicdrive.com/forums/attachment.php?attachmentid=1268&d=1190000634

3) Describe problem: The swiss army script found in this zip file from your site automatically retrieves images from a directory and runs them as a slideshow in random order. Is there a tweak to this script that will run the images in order by date/time? This zip file script seems to be different than the entire script on the swiss army page. Thanks.

jscheuer1
12-24-2008, 03:04 PM
That actually shows the slides in the order in which the server finds them within the folder. Which generally is already by file date. Remember though, that when you upload a file to the server, it gets the date stamp of that event, it doesn't carry its original date stamp with it from the local computer.

If you were to name the image files in a way that reflected the date that you wanted them to have:

20080101.jpg

for 2008 01 (January) 01 (the 1st), for example, you could sort the array:


. . . closedir($handle);
}
return($files);
}

echo "var slides=new Array();" . "\n";
returnimages();
?>

slides.sort();

var preload_ctrl_images=false;

slides.no_controls=1; // will set a slide show with no controls
slides.no_descriptions=1; //use f . . .

You may also want to look here for more info on sorting as regards this thread:

http://www.dynamicdrive.com/forums/showthread.php?t=40009

breagan1
12-24-2008, 04:00 PM
That's very helpful. How would I code it to sort descending?

jscheuer1
12-24-2008, 04:06 PM
After:


slides.sort();

do:


slides.reverse();

breagan1
12-24-2008, 05:56 PM
You're the best! Merry Christmas.

breagan1
12-26-2008, 08:42 PM
Hi John,

I owe you an apology. In a post about php photo album I asked how to have the images open left aligned in a frame. That question should have gone here. My slideshow opens centered in the window. I am using the code found at this link:
http://www.dynamicdrive.com/forums/a...8&d=1190000634

My web page can be found here:
http://www.marcellusny.com/cam_2_archives/

You can see that if your resolution is set above 800x600 the images open left aligned in the frame but the slideshow opens centered. I like this format for viewing the images as pop-up windows can be annoying. I've tried a few mods to the 'center' codes in the script but to no avail. Thanks.

jscheuer1
12-27-2008, 02:09 AM
No need to apologise, except perhaps for the fact that your link to "I am using the code found at this link" is broken. But we are usually pretty easy going around here if we can at least understand what the question is.

As to which, if I've understood the question, on your slideshow.php page, add the highlighted:


<body>
<div style="width: 352px;">
<script type="text/javascript">
new inter_slide(slides, 352, 288)
</script>
</div>
</body>

breagan1
12-27-2008, 04:43 AM
Awesome, you're the best. I put a link to your site under my slideshows. Thanks.

--Bill