PDA

View Full Version : Ultimate Fade-in Slideshow auto images



bbcg59
09-16-2007, 11:05 PM
1) Script Title: Ultimate Fade-in slideshow (v1.51)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem:
Ultimate Fade-in Slideshow with automatic image retrieval desired. I love your site and over the last two weeks have learned and used a number of the scripts in creating a photography business web site. I am a newbie, and have been cutting and pasting from various sources and learning along the way. I have searched the forum using keywords of - image retrieve auto populate Ultimate Fade-in - and have come up empty.

I would like to establish a directory that the slideshow automatically pulls images from, like the http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm PHP Photo Album Script uses the http://www.dynamicdrive.com/dynamicindex4/phpgallery/getpics.php.txt getpics.php to create a gallery page. I am not even remotely capable of integrating the two if it is even possible. I have managed to get it to run 3 slideshows at the same time centered horizontally www.bbcgphoto.com/index.php .

Is this possible ?

jscheuer1
09-17-2007, 03:52 AM
Actually, this (grabbing dissimilar images from a folder, using PHP) works better with the Swiss Army slide show (http://www.dynamicdrive.com/dynamicindex14/swissarmy/index.htm):

1268

Notes: The main script from DD demo page (swissarmy.js) as mentioned on the first above linked page is included on the attached (second linked zipped) page. Instead of the on page code shown on the DD demo page, use the on page PHP and javascript script shown in the above attached zipped file (second link). The images in this attached zipped example go in a folder named images off of the folder that the above attached page is in. With not much tinkering, multiple folders of images could be accessed.

Tailslide
09-21-2007, 09:40 AM
Hi,

Following from the OP and your response - would the Ultimate fade-in script work ok pulling images that are all the same size from a particular folder or would you still recommend the Swiss Army slideshow?

If it's the latter, can I remove the controls without messing up the script as I don't want those.

Many thanks

Edit: I noticed a link to a tutorial on dynamically populating a javascript slideshow with PHP but I'm not sure how how to combine the two scripts e.g. how to replace this bit in UFISS:


fadeimages[0]=["images/mainpic1.jpg", "", ""]
fadeimages[1]=["images/mainpic2.jpg", "", ""]
fadeimages[2]=["images/mainpic3.jpg", "", ""]

With the call from the JS kit tutorial:

<script src="/images/getimages.php"></script>

Which inserts the image array gathered by getimages.php.

jscheuer1
09-21-2007, 03:22 PM
You would probably be best off using Swiss Army without the controls. Even though U-Fade can be adapted, only one of its undesirable characteristics would be eliminated by having the images all of uniform dimensions. Another is its method of preloading, which is done all at once, delaying the start of the show. When pulling many images from a folder, it is best to use incremental preloading as does Swiss Army.

Just for your information, using PHP to get an array of images is just a matter of making sure that the array PHP creates can be utilized by the existing script.

To do that, it must create an array in the same format as that which the script is expecting and of the same name. It must occur before the other script, and the array that it is replacing must be removed from the slide show script.

Tailslide
09-21-2007, 03:37 PM
Thanks for that - I'll have a go with the Swiss Army slideshow.

Just tried it and it works perfectly for the particular application - thanks!

freedomd
09-22-2010, 02:00 AM
LOVE the mod of this script to pull images from folder. I can not figure out what change to make in order to have the images rotate in alpha/numeric order. Please advise! Thanks!!!

jscheuer1
09-22-2010, 04:48 AM
LOVE the mod of this script to pull images from folder. I can not figure out what change to make in order to have the images rotate in alpha/numeric order. Please advise! Thanks!!!

Replace:


<?
function returnimages($dirname="./images/") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
echo 'slides[' . $curimage .']=["' . $dirname . $file . '", "", ""];' . "\n";
$curimage++;
}
}

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

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

with:


<?php
function returnimages($dirname = './images/') {
$pattern = '#\.(jpg|jpeg|png|gif|bmp)$#i';
$files = array();
if($handle = opendir($dirname)){
while(($file = readdir($handle)) !== false){
if(preg_match($pattern, $file)){
array_push($files, "\t['" . $dirname . $file . "', '', '']");
}
}
closedir($handle);
natsort($files);
}
return "var slides = [\n" . implode(",\n", $files) . "\n];\n";
}

echo returnimages();
?>

freedomd
10-07-2010, 04:04 AM
Thanks! Another mod:

I need the fn to look something like this...

function returnimages($dirname = './artistlist/$artist[codename]/gallery/') {

...but it doesn't work. I don't think it likes the $artist[codename]? Successfully call that table in other areas of the page, but not the slideshow.

jscheuer1
10-07-2010, 01:28 PM
That table? Is it a database table?

In any case, if:


$artist[codename]

doesn't resolve to a valid component of the path, it cannot work. Also, you are using literal quotes (') so it will never resolve. Even if it does, I've observed that PHP doesn't like resolving variables inside a construct like that. So it can be put inside the function. But then the 'table' as you call it probably is out of scope. So instead of:


function returnimages($dirname = './artistlist/$artist[codename]/gallery/') {

try:


function returnimages() {
$dirname = './artistlist/' . $GLOBALS['artist'][codename] . '/gallery/';

or:


function returnimages() {
$dirname = './artistlist/' . $GLOBALS['artist']['codename'] . '/gallery/';

freedomd
10-07-2010, 03:01 PM
You are great! Many, many thanks ... It is a very large, complex database.