Code: Select all
<?php
// rotate images randomly but w/o dups on same page - format:
// <img src='rotate.php?i=0'> - rotate image #0 - use 'i=1'
// for second, etc
// (c) 2004 David Pankhurst - use freely, but please leave in my credit
$images=array( // list of files to rotate - add as needed
"images/paulinewoolley/bjarg.jpg",
"images/paulinewoolley/ion.jpg",
"images/paulinewoolley/foss.jpg",
"images/paulinewoolley/altitude1.jpg",
"images/paulinewoolley/altitude5.jpg",
"images/paulinewoolley/altitude6.jpg" );
$total=count($images);
$secondsFixed=10; // seconds to keep list the same
$seedValue=(int)(time()/$secondsFixed);
srand($seedValue);
for ($i=0;$i<$total;++$i) // shuffle list 'randomly'
{
$r=rand(0,$total-1);
$temp =$images[$i];
$images[$i]=$images[$r];
$images[$r]=$temp;
}
$index=(int)($_GET['i']); // image index passed in
$i=$index%$total; // make sure index always in bounds
$file=$images[$i];
header("Location: $file"); // and pass file reference back
?>Code: Select all
<img src='canstudios.org/rotate.php?i=0'>image #1
<img src='canstudios.org/rotate.php?i=1'>image #2
<img src='canstudios.org/rotate.php?i=2'>image #3
Here is the html code from the index.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>Can Studio</title>
</head>
<center>
<body>
<div class="wrapper">
<div class="header">
<img src="images/logo.jpg" align="left" border="0" />
</div>
<ul class="navigation">
<li><a href="contact.html">Contact</a></li>
<li class="sub"><a href="#">Artists</a>
<ul class="sub">
<li><a href="kit_anderson.html">Kit Anderson</a></li>
<li><a href="liza_aspell.html">Liza Aspell</a></li>
<li><a href="karen_frazer.html">Karen Fraser</a></li>
<li><a href="billie_ireland.html">Billie Ireland</a></li>
<li><a href="sarah_jane_terry.html">Sarah Jane Terry</a></li>
<li><a href="marek_tobolewski.html">Marek Tobolewski</a></li>
<li><a href="inge_tong.html">Inge Tong</a></li>
<li><a href="pauline_woolley.html">Pauline Woolley</a></li>
<li><a href="terry_duffy.html">Terry Duffy</a></li>
</ul>
</li>
<li><a href="events.html">Events</a></li>
<li><a href="news.html">News</a></li>
<li><a href="index.html">Home</a></li>
</ul>
<div class="index-spacer"></div>
<?php include("rotate.php"); ?>
<img src='canstudios.org/rotate.php?i=0'>image #1
<img src='canstudios.org/rotate.php?i=1'>image #2
<img src='canstudios.org/rotate.php?i=2'>image #3
<img src='canstudios.org/rotate.php?i=3'>image #4
<img src='canstudios.org/rotate.php?i=4'>image #5
<img src='canstudios.org/rotate.php?i=5'>image #6
<div class="information"><p class:"information">Founded in 1987, Can Studios are one of the longest running studio groups in Nottingham today. Members of the group have instigated innovative and enduring artist-led activities which have included collaborations, warehouse exhibitions, open studios, offsite projects, art auctions, residencies, gallery collaborations and installations in alternative urban venues. These endeavours have stimulated the growth of contemporary art in Nottingham over the last 20 years. Can Studios now occupies a new location in Sneinton, near to the city centre. Here the studio members continue their committed involvement in individual projects, and in developing ambitious new concepts for collaborative possibilities.</p></div></div>
</body>
</center>
</html>