Displaying random images

Last modified: August 26, 2009 - 23:08

This is made possible by a script found at www.alistapart.com called rotate.php.

Procedure:

  1. Create a directory under the web server's document root. I placed it under my theme's directory.
  2. Populate that directory with images.
  3. Download script and put it in a nice resting place.
  4. Edit script so it can find your image directory. To avoid editing you can just place the script in the same directory as the images.
  5. Under your theme's config, for custom logo, instead of a path to an image use the path to the script.
  6. You're done.

Added swfs and called from theme code

carole - March 13, 2009 - 22:39

I love this code, thank you. It worked quickly & easily. I also added this line to the php to enable rotating swfs:

$extList['swf'] = 'application/x-shockwave-flash';

I called it from my theme page.tpl.php as follows:

  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="263" height="150" align="top" title="fluidit solutions videos">
<param name="movie" value="<?php print $front_page . $directory; ?>/videos/rotate.php">
    <param name="quality" value="high"><param name="LOOP" value="false">
    <embed src="<?php print $front_page . $directory; ?>/videos/rotate.php" width="263" height="150" loop="false" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
  </object>

 
 

Drupal is a registered trademark of Dries Buytaert.