Simple Image Gallery[Solved]
Posted: Fri May 28, 2004 3:36 am
Otay i just need a lil help, you see im trying to make a gallery script and ive had help, but i have a prob and im asking if anyone can help me...
okie, im trying to get the following script to display 20 images per page, but if theres like 23 i want 3 on page 2, this way i can use the same script for each directory(im making an anime site and i have a total of 154 gallerys ^_^ and the # of pic differ in each gallery, i host all the pics from my own pc ^_^) now the prob w\ this script is that if theres 23pics it only shows 20 but if theres like 16 it will show pics of x's. TT_TT please please help me TT_TT
p.s. i have it set up so it reads a fake pic like 1x1px and it opens a bigger pic on my server, u can see what i mean at http://falconxanime.tk
This is index.php
this is anime.php i use this so i dont have to change the index.php for each directory
okie, im trying to get the following script to display 20 images per page, but if theres like 23 i want 3 on page 2, this way i can use the same script for each directory(im making an anime site and i have a total of 154 gallerys ^_^ and the # of pic differ in each gallery, i host all the pics from my own pc ^_^) now the prob w\ this script is that if theres 23pics it only shows 20 but if theres like 16 it will show pics of x's. TT_TT please please help me TT_TT
p.s. i have it set up so it reads a fake pic like 1x1px and it opens a bigger pic on my server, u can see what i mean at http://falconxanime.tk
This is index.php
Code: Select all
<?php
include("../../Header.php");
include("anime.php");
include("../../Navigation.php");
include("../Body.php");
//Variables
$images=20;
$a=0;
$filepath = 'images/';
$url_path = 'images/';
$dir = dir($filepath);
//grab start
if(isset($_GET['next']) && is_numeric($_GET['next']))
{
$start=$_GET['next'];
}
elseif(isset($_GET['pre']) && is_numeric($_GET['pre']))
{
$start=$_GET['pre'];
}else{
$start=0;
}
if($start<0){$start=0;}
$pos=$start;
//Table Setup
echo "<table border="0" cellpadding="3" cellspacing="3" width="100%"><tr>";
while($image=$dir->read()) {
if($image == "." || $image == "..") {
continue;
}
$imagearray[]=$image;
}
//set limits
$count=count($imagearray);
if($start>$count-$images)
{
$start=$count-$images;
}
$limit=$start+$images;
// loop through array from start
for($i=$start;$i<$limit;$i++)
{
//Table Return
//Link
if ($a%5==0) {echo "</tr><tr>";}
echo"<td><a href="http://falconxanime.homelinux.com:82/Anime/".$anime."/".$imagearray[$i]."">";
echo"<img src="http://falconxanime.homelinux.com:82/Anime/".$anime."/tn/".$imagearray[$i]."" alt="".$anime."-".$imagearray[$i].""></a></td>";
$a++;
}
echo"</tr></table>";
?>
<br>
<?
//display next previous
if($start>0)
{
$pre=$pos-$images;
echo"<center><a href="".$_SERVER['PHP_SELF']."?pre=".$pre."" >Previous</a> ";
}
if($start<$count-$images)
{
$nex=$pos+$images;
echo"<center><a href="".$_SERVER['PHP_SELF']."?next=".$nex."" >Next</a> ";
} ?>
<?
include("../../footer.php");
?>Code: Select all
<?php
$anime = "";
?>