Hi
I wonder if anyone can help me?
I copied a picture gallery script off of the following website:
The problem i am having is that the gallery starts off fine, i can view the pics and it gives me nav links to navigate the pictures, BUT as soon as i click on the next link OR i click on a picture to view the larger version - it gives me an error message.
you can view my picture gallery at :
to get an idea of what messages i recieve.
i will also include all the code i have included in the file at the bottom of this message.
I am new at PHP so i am probably not picking a mistake up somewhere????
Please help!! i have been racking my brain.
thanks.
<html>
<head>
<title>photo gallery</title>
<script language="javascript">
<!--
function photo_open(link, width, height)
{
var photoWindow = window.open(link,"photo",
'toolbar=0,location=0,directories=0,status=0,
menubar=0,scrollbars=0,resizable=0,width=
'+width+',height='+height);
}
//-->
</script>
<body bgcolor="#FFFFFF" text="#000000"
link="#00CCFF" alink="#00CCFF" vlink="#00CCFF">
<table cellpadding="2" align="center"
cellspacing="2" width="80%" border="0" >
<?PHP
//initialize variables
$data_file = "list.photos.txt";
$thumbnail_dir = "thumbs/";
$num_rows = 3;
$photos_per_row = 3;
$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;
for ($row=0; $row < $num_rows; $row++){
print("<tr>\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("<td align=\"center\">
<a href=\"javascript
hoto_open('photo_display.php?photo=
".trim($photos[$i])."','".$image_size[0]."','
".$image_size[1]."');\">
<img src=\"".$thumbnail.
"\" ".$thumb_image_size[3]."></a></td>\n"
;
} else {
print("<td></td>\n"
;
}
$i++;
}
print("</tr>\n"
;
}
//end table
?>
</table>
<div align="center">
<?PHP
//print out navigation links
if(($start == 0) && ($next_start < $total_photos)){
//you're at the beginning of the photo gallery
?>
<font face="arial, helvetica" size="2">
<b><a href="index.php?start=<
?PHP print($next_start):?>">next page</a>
<font color="#FF0000">»</font></b>
</font>
<?PHP
}
elseif (($start > 0) && ($next_start < $total_photos)){
//you're in the middle of the photo gallery
?>
<font face="arial, helvetica" size="2">
<b><font color="#FF0000">«
</font> <a href=\"index.php?start=
<?PHP print($prev_start); ?>">prev page</a></b></font>
<b>|</b>
<font face="arial, helvetica" size="2">
<b><a href="index.php?start=<
?PHP print($next_start); ?>">next page</a> <font
color="#FF0000">»</font></b></font>
<?PHP
}
elseif(($start == 0) && ($next_start > $total_photos)){
//you're in a photo gallery with only one page of photos
?>
<?PHP
}
else {
//you're at the end of the photo galley
?>
<font face="arial, helvetica" size="2">
<b><font color="#FF0000">«</font>
<a href="index.php?start=<?PHP print($prev_start); ?>
">prev page</a></b></font>
<?PHP
}
?>
</div>
</body>
</html>
I wonder if anyone can help me?
I copied a picture gallery script off of the following website:
The problem i am having is that the gallery starts off fine, i can view the pics and it gives me nav links to navigate the pictures, BUT as soon as i click on the next link OR i click on a picture to view the larger version - it gives me an error message.
you can view my picture gallery at :
to get an idea of what messages i recieve.
i will also include all the code i have included in the file at the bottom of this message.
I am new at PHP so i am probably not picking a mistake up somewhere????
Please help!! i have been racking my brain.
thanks.
<html>
<head>
<title>photo gallery</title>
<script language="javascript">
<!--
function photo_open(link, width, height)
{
var photoWindow = window.open(link,"photo",
'toolbar=0,location=0,directories=0,status=0,
menubar=0,scrollbars=0,resizable=0,width=
'+width+',height='+height);
}
//-->
</script>
<body bgcolor="#FFFFFF" text="#000000"
link="#00CCFF" alink="#00CCFF" vlink="#00CCFF">
<table cellpadding="2" align="center"
cellspacing="2" width="80%" border="0" >
<?PHP
//initialize variables
$data_file = "list.photos.txt";
$thumbnail_dir = "thumbs/";
$num_rows = 3;
$photos_per_row = 3;
$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;
for ($row=0; $row < $num_rows; $row++){
print("<tr>\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("<td align=\"center\">
<a href=\"javascript
".trim($photos[$i])."','".$image_size[0]."','
".$image_size[1]."');\">
<img src=\"".$thumbnail.
"\" ".$thumb_image_size[3]."></a></td>\n"
} else {
print("<td></td>\n"
}
$i++;
}
print("</tr>\n"
}
//end table
?>
</table>
<div align="center">
<?PHP
//print out navigation links
if(($start == 0) && ($next_start < $total_photos)){
//you're at the beginning of the photo gallery
?>
<font face="arial, helvetica" size="2">
<b><a href="index.php?start=<
?PHP print($next_start):?>">next page</a>
<font color="#FF0000">»</font></b>
</font>
<?PHP
}
elseif (($start > 0) && ($next_start < $total_photos)){
//you're in the middle of the photo gallery
?>
<font face="arial, helvetica" size="2">
<b><font color="#FF0000">«
</font> <a href=\"index.php?start=
<?PHP print($prev_start); ?>">prev page</a></b></font>
<b>|</b>
<font face="arial, helvetica" size="2">
<b><a href="index.php?start=<
?PHP print($next_start); ?>">next page</a> <font
color="#FF0000">»</font></b></font>
<?PHP
}
elseif(($start == 0) && ($next_start > $total_photos)){
//you're in a photo gallery with only one page of photos
?>
<?PHP
}
else {
//you're at the end of the photo galley
?>
<font face="arial, helvetica" size="2">
<b><font color="#FF0000">«</font>
<a href="index.php?start=<?PHP print($prev_start); ?>
">prev page</a></b></font>
<?PHP
}
?>
</div>
</body>
</html>