View Single Post
  #5 (permalink)  
Old 06-13-04, 08:08 PM
jugo«§³» jugo«§³» is offline
New Member
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
You can make it work with PHP.

Just get a random Image Script like this one:

Code:
<html>
<head>
<meta http-equiv="refresh" content="5">
<head>
<body>

<?php

function getRandomImage($dir,$type='random')
{ 
global $errors,$seed; 

  if (is_dir($dir)) {  

  $fd = opendir($dir);  
  $images = array(); 

      while (($part = @readdir($fd)) == true) {  

          if ( eregi("(gif|jpg|png|jpeg)$",$part) ) {
              $images[] = $part; 
          } 
      } 

    // adding this in case you want to return the image array
    if ($type == 'all') return $images;

    if ($seed !== true) {
      mt_srand ((double) microtime() * 1000000);
      $seed = true;
    }
      
      $key = mt_rand (0,sizeof($images)-1); 

    return $dir . $images[$key]; 

  } else { 
      $errors[] = $dir.' is not a directory'; 
      return false; 
  } 
} 

$image = getRandomImage('yourimagedir/');

echo "<img src='$image' alt='Random Image' border=\"0\">";

?>

</body>
</html>
The above will load a random image from the "yourimagedir" directory and will refresh the page every 5 seconds.

Just change the variables accordingly and there you have a PHP/HTML Slideshow.

Hope it helps.

jugo«§³»
http://www.s3squad.com

Last edited by jugo«§³»; 06-13-04 at 08:11 PM.
Reply With Quote