New Item

6 posts by 3 authors in: Forums > CMS Builder
Last Post: April 21, 2008   (RSS)

By dunlap - April 17, 2008

Would it be possible to create an image randomizer? The utility would have an uploader for the images or media & then the php element generated could be moved around the page.

Just a thought

Re: [dunlap] New Item

By Dave - April 17, 2008

Hi dunlap,

You could definitely do that with CMS Builder. How many images did you want to have?
Dave Edis - Senior Developer
interactivetools.com

Re: [dunlap] New Item

By Dave - April 17, 2008

Ok, and what other data will you need for each image? Maybe just a link?

If that's the case I'm thinking a "single page" section editor with just a upload field, and then create a "page viewer" that shows all the images.

Once you get that far (do that first) you'll want some code like this to randomize the images and show just the first one:

<?php
$uploads = getUploads(...your settings here...);
shuffle($uploads); // randomize
foreach ($uploads as $upload): ?>
?>
<img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>"
alt="" /><br/>
<?php break; ?>
<?php endforeach ?>


Hope that helps. Let me know if you get stuck along the way.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] New Item

By grauchut - April 18, 2008 - edited: April 18, 2008

Dave would this look like the top where the three pictures rotate on this page?

http://www.colonialparkfire.org/



Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] New Item

By Dave - April 21, 2008

No, it would just show the images in random order. It wouldn't have them fade in and out and rotate dynamically. What you need for that is a flash (or javascript) image rotator. There's a flash one here:
http://www.jeroenwijering.com/?item=jw_image_rotator

The first step is to figure out how to get it working with regular HTML. Once you get it working with regular HTML, then you can get CMS Builder to automatically output the same type of HTML so it's all dynamic.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com