SleepIsDeath/gameSource/templates/index.php

125 lines
2.4 KiB
PHP
Raw Permalink Normal View History

<?php
/*
This is the index file for a Flip Book that is generated by Sleep Is Death.
This file is automatically copied into each Flip Book, along with default
header and footer files.
To change the look/feel of the stuff *around* the Flip Book content, simply
modify the "header.php" and "footer.php" files with your own HTML.
The "frameList.php" file is auto-generated by Sleep Is Death, and it lists the
frames to be included in the Flip Book.
You can edit "frameList.php" to skip certain frames or to change the order of
the frames.
*/
include( "header.php" );
//$frameList = array( 2, 1, 3 );
// frame list file is auto-generated by SleepIsDeath
include( "frameList.php" );
$imageNumber = "00001";
if( isset( $_REQUEST[ "frame" ] ) ) {
$imageNumber = $_REQUEST[ "frame" ];
}
$fileName = "images/$imageNumber".".png";
if( ! file_exists( $fileName ) ) {
// don't let weird file names through
// display a broken image instead
$fileName = "";
}
reset( $frameList );
while( current( $frameList ) != $imageNumber &&
current( $frameList ) !== FALSE ) {
$x = next( $frameList );
}
$prev = prev( $frameList );
if( $prev === FALSE ) {
// this page at start, no prev
$prev = -1;
reset( $frameList );
}
else {
// advance back
next( $frameList );
}
$next = next( $frameList );
if( $next === FALSE ) {
// this page at end
// no next
$next = -1;
}
list($width, $height, $type, $attr) = getimagesize( $fileName );
echo "<table border=0><tr><td colspan=2>";
// clicking on image goes to next
if( $next != -1 ) {
echo "<a href=\"index.php?frame=$next\" title=\"Next\">";
}
echo "<img src=\"$fileName\" border=0 width=$width height=$height>";
if( $next != -1 ) {
echo "</a>";
}
echo "</td></tr>";
echo "<tr>";
echo "<td>";
if( $prev != -1 ) {
echo "<a href=\"index.php?frame=$prev\" title=\"Previous\">".
"<img src=\"prev.png\" width=\"32\" height=\"32\" border=\"0\"></a>";
}
echo "</td>";
echo "<td align=right>";
if( $next != -1 ) {
echo "<a href=\"index.php?frame=$next\" title=\"Next\">".
"<img src=\"next.png\" width=\"32\" height=\"32\" border=\"0\"></a>";
}
echo "</td>";
echo "</tr></table>";
// preload next frame's image to speed loading... make it tiny and unobtrusive
if( $next != -1 ) {
echo "<img src=\"images/$next.png\" border=0 width=0 height=0>";
}
include( "footer.php" );
?>