I found this script on webmonkey site, it's working well exept one big problem ๐ wen I press the next page link i recive this error :
Warning: Unable to open thumbs/ in c:\web\apache\htdocs\gal\index.php on line 73
Warning: Unable to open in c:\web\apache\htdocs\gal\index.php on line 74
but I see the table where the picture shold be, but I don't see any picture, and I'm sure I'm not blind ๐
Can you help me?
<?PHP
//initialize variables
$data_file = "list.photos";
$thumbnail_dir = "thumbs/";
$num_rows = 5;
$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;
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 bgcolor=\"#FFFFCC\" class=\"button\" align=\"center\"><a href=\"javascript:photo_open('photo_display.php?photo=".trim($photos[$i])."','".$image_size[0]."',' ".$image_size[1]."');\"><img border=\"1\" 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="indexp.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=\"indexp.php?start=<?PHP print($prev_start); ?>">prev page</a></b></font>
<b>|</b>
<font face="arial, helvetica" size="2">
<b><a href="indexp.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="indexp.php?start=<?PHP print($prev_start); ?>
">prev page</a></b></font>
<?PHP
}
?>