Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 66447

Re: Slideshow of images from a directory/folder?

$
0
0

osgood_ wrote:

 

Niknab0417 wrote:

 

This prevents the page from crashing since it only loads 10 images, but it's still loading all 10 at once. I can't seem to get the images to work with the sldieshow.

 

 

Not sure exactly what you need? You say you want a 'slideshow' - so how many images do you need for the slideshow? Obviously for a slideshow you need a set quantity of images to load to the page.

 

The code I provided will give you a slideshow which cycles through 10 images - one at a time. What is happening in your case?

 

All 10 images load at once. It picks 10 images at random, but doesn't cycle through them one at a time. It's entirely possible I'm typing it wrong, though. Either I messed up the php or I didn't input the code into the jquery file correctly.

 

<div id='pics'>

   <?php

        $directory = './Allppl2';

        $images = array();

        if ($handle = opendir($directory)) {

        while (false !== ($file = readdir($handle))) {

        if (preg_match("/\.png$/", $file)) $images[] = $file;

        elseif (preg_match("/\.jpg$/", $file)) $images[] = $file;

        elseif (preg_match("/\.jpeg$/", $file)) $images[] = $file;

        elseif (preg_match("/\.gif$/", $file)) $images[] = $file;

        }

        shuffle($images);

        closedir($handle);

        }

        for($i= 0; $i < 10; $i++) { 

            echo '<img src="Allppl2/'.$images[$i].'" \>';

        } 

    ?>

</div>

 

 

And part of the javascript file:

 

$('#start').click(function () {

        var allppl = $.post('gest-slideshow.php');

        if ($('input[name=ppl]:checked').val() == 30) {

            $('#pics').show(function () {

                $(allppl).cycle({

                    fx: 'fade',

                    next: '#pics',

                    timeout: 30000,

                    random: 1

                });

            });


Viewing all articles
Browse latest Browse all 66447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>