shuffle images

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 21, 2012   (RSS)

By SkidderChains - November 19, 2012

Hoping someone can help with this one.....

I have a multi record section named Images that provides the images for a rotating image header.. Within that section, there is a field Image where multiple images can be uploaded.

There is also a check box to select which pages the Record Images should display on.

I am trying to set it up so that the code randomly selects a section, and then the image from that section displays one image. then it moves on to the next random sections and pulls one image....continuously. This is what I have so far, and it works, but only takes the first image it selects. I would like it to go back to the section and skip the image it has already shown and move on to the next image...

<?php shuffle($imagesRecords); ?>

<?php foreach ($imagesRecords as $record): ?>

<?php if ($record['locations']): ?>

<?php $count = 0; ?>
<?php shuffle($record['image']); ?>
<?php foreach ($record['image'] as $upload):?>
<?php if (++$count > 1) { break; } ?>


<img src="<?php echo $upload['urlPath'] ?>" alt=""/>


<?php endforeach ?>

<?php endif ?>

<?php endforeach ?>


I hope that makes sense. here is the link to the page as it is working now. Randomly pulling a section and then shuffling one image from each section.

http://new.wallingfords.com/locations.php

THanks.

Re: [greg] shuffle images

By SkidderChains - November 21, 2012

It seems to be working, but taking a long time to load the images and is effecting the transition.... Any thoughts. I will have to trouble shoot on this end.

Thanks for the help....

Re: [SkidderChains] shuffle images

By gregThomas - November 21, 2012

I've just had a look at the site and the images seemed to be loading quickly for me, could it have been your connection or hosting service being temporarily slow? If your still having the issue there are a few things you could try:

You could try lowering the quality of the images to the point where the quality isn't affected, but the image file size is reduced.

Check the images you are uploading aren't any larger than they need to be, as larger images take longer to load. Looking at the example you've given it looks as if you'r already doing this.

Finally, check that the image slider your using preloads the images, I think the image slider your using already does do this.
Greg Thomas







PHP Programmer - interactivetools.com