Slideshow , autorotation of all files in directory. Written in PHP

<?

# read .jpg files into array
$dir=opendir(".");
while ($dat = readdir($dir)) { if (substr($dat,strlen($dat)-4)==".jpg") { $pics[]=$dat; }}
closedir($dir);

# Increment the image value
if ($_REQUEST['image'])
{ $img=$_REQUEST['image']; $img++;
} else {$img=1;}
if ( $img >= count($pics))  {$img=0;}

# Automatic reload
print '<meta http-equiv="refresh" content="5, url=?image='.$img.'">';

# Show picture #img in pics array
print "<img src=".$pics[$img+1].">";
?>
~

 

Dette indlæg blev udgivet i Knowledge Base, Old Base, Workstation. Bogmærk permalinket.

Skriv et svar