topical media & game development

talk show tell print

server-php-micro-show-index.php / php



  <?php
  
**************************************************************************** Micro Photo Slideshow Version: 1.0 Release date: 2007-09-11 USAGE: You only need to copy the files into your image folder. All *.jpg and *.jpeg images will be displayed. You can set the interval and album title by setting up the timer and title variable below. ****************************************************************************

  
  
  
*********** S E T T H I S V A R I A B L E S ***************************

  
   timer = 5; // Switch to the next image after 5 sec
   title = "Micro Photo Slideshow"; // Title of your photo album
  
***************************************************************************

   
   
      
  function displayPhoto(){
  //dir=".";
  dir="../../../../assets/img/create/0/"; // do not omit trailing
  
     global gid;
     id = isset(_GET['id']) ? _GET['id'] : 0;
     actFile = 0;
             
          // Open the actual directory
          if (handle = opendir(dir)) {
                  // Read all file from the actual directory
                  while (file = readdir(handle))  {
                          // Check whether tha actual item is a valid file
                          //echo  file." ".dir.file."<br>";
                          if (is_file(dir.file)){
                                  // Check whether the actual image is a thumbnail
                                if ((strpos(dir.file,'.jpg')) || (strpos(dir.file,'.jpeg'))){
                    if (actFile == id){
                       return '<img src="'.dir.file.'" alt="Slideshow" />';
                    }
                    if (actFile == 0){
                       first = '<img src="'.dir.file.'" alt="Slideshow" />';
                    }
                    actFile++;
                                }
                     }
             }
          }
     gid = 1;
          return first;        
  }
  
  gid = isset(_GET['id']) ? _GET['id'] : 0;
  gid++;
  
  image = displayPhoto();
  
  url = _SERVER['PHP_SELF'].'?id='.gid;
  
  ?>
  
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
  <html>
  <head>
     <title>Micro Photo Slideshow</title>
     <link href="style/style.css" rel="stylesheet" type="text/css" />
     <?php echo '<META HTTP-EQUIV="Refresh" CONTENT="'.timer.'; URL='.url.'" />'; ?>
  </head>
  <body>
    <div id="main">
      <div class="caption"><?php echo title; ?></div>
        <table align="center"><tr><td><?php echo image; ?></td></tr></table>                
      <div id="source">Micro Photo SlideShow 1.0</div>
    </div>
  </body>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.