if (ini_get('register_globals') != 1)
{
$supers = array('_REQUEST','_ENV','_SERVER');
foreach ($supers as $__s)
{
if (is_array($$__s) == true) extract($$__s, EXTR_OVERWRITE);
}
unset($supers);
}
$data_file = "list.photos";
$thumbnail_dir = "thumbs/";
$num_rows = 6;
$photos_per_row = 4;
$photos = file($data_file);
$total_photos = sizeof($photos);
$photos_per_page = $num_rows * $photos_per_row;
//check to see if the start variable exists in the URL.
//If not, then the user is on the first page - set start to 0
if(!isSet($start))
{
$start = 0;
}
//init i to where it needs to start in the photos array
$i = $start;
$prev_start = $start - $photos_per_page;
$next_start = $start + $photos_per_page;
echo '';
for ($row=0; $row < $num_rows; $row++)
{
print("\n");
for ($col=0; $col < $photos_per_row; $col++)
{
if($i < $total_photos)
{
$thumbnail = $thumbnail_dir.trim($photos[$i]);
$thumb_image_size = GetImageSize($thumbnail);
$image_size = GetImageSize(trim($photos[$i]));
print(" | \n");
}
else
{
print(" | \n");
}
$i++;
}
print(" \n");
}
echo '
';
if(($start == 0) && ($next_start < $total_photos))
{
echo "next page»";
}
elseif (($start > 0) && ($next_start < $total_photos))
{
echo "« prev page | next page »";
}
elseif(($start == 0) && ($next_start > $total_photos))
{
}
else
{
echo "«prev page";
}
?> |