This is not the current version. Will be updated soon.
Simple PHP based picture gallery for HTML websites with an index page and large image pages
with navigation items.
back to top
Copy the three core files (pics.php, image.php, pics.css) to a directory on your webserver.
Create a directory for each gallery in that directory and copy your images into a directory
called 'images' and your thumbnails named tn_<matchingImagefile> into a directory
called 'thumbnails' in each gallery directory. Copy an edited version of the file sample.php
in each gallery directory and name it <gallery>.php. Edit the first five lines;
the stylesheet is the stylesheet of your website to get the proper background color and
font styles, not the pics.css stylesheet.
Maybe this code does not work with other webservers than apache because several
CGI environment variables are needed.
back to top
Open the edited <gallery>.php with a webbrowser.
back to top
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
back to top
<?PHP
// Pic Gallery - simple PHP bases Picture Gallery for Websites
// last changed: June 07. 2004
// Copyright (C) 2004 Soenke Gluch
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$name = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "."));
$name = substr($name, strrpos($name, "/")+1);
$srv_base_dir = $_SERVER['DOCUMENT_ROOT'];
$srv_dir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/"));
$srv_dir = substr($srv_dir, 0, strrpos($srv_dir, "/"));
$pic_dir = $srv_dir . "/" . $name;
$thumbnails = glob($srv_base_dir . $pic_dir . "/thumbnails/*");
print
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dt
d\">
<html>
<head>
<title>$titel</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"$stylesheet\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"/pics/pics.css\">
</head>
<body class=\"randlos\">
<p class=\"zentriert\"><span class=\"titel\">$titel</span></p>
<table class=\"zentriert\">
<tr>"
;
for ($i=0;$i<sizeof($thumbnails);$i++) {
$thumbnails[$i] = substr(strrchr($thumbnails[$i], "/"), 1);
if ((bcmod($i, $rows) == 0) && ($i != 0)) {
print "</tr><tr>";
}
print
"<td>
<a href=\"$srv_dir/image.php?index=$name&nummer=$i&height=$height&s
tylesheet=$stylesheet\" class=\"tn\">
<img src=\"$pic_dir/thumbnails/$thumbnails[$i]\" alt=\"$thumbnails[$i]\" height=\
"$tn_height\" class=\"tn\">
</a>
</td>
";
}
print
"</tr>
</table>
</body>
</html>"
;
?>
<?PHP
// This file is part of Pic Gallery
// Copyright (C) 2003/2004 Soenke Gluch
// Pic Gallery is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// Pic Gallery is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Pic Gallery; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$nummer = $_GET["nummer"];
$height = $_GET["height"];
$srv_dir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/"));
$stylesheet = $_GET["stylesheet"];
$srv_base_dir = $_SERVER['DOCUMENT_ROOT'];
$index = $_GET["index"];
$pic_dir = $srv_dir . "/" . $index;
$images = glob($srv_base_dir . $pic_dir . "/images/*");
$image = substr(strrchr($images[$nummer], "/"), 1);
print "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd
\">
<html>
<head>
<title>$image</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"$stylesheet\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"/pics/pics.css\">
</head>
<body class=\"randlos\">
<table class=\"zentriert\">
<tr>"
;
print
"<td>
<a href=\"$pic_dir/$index.php\">Index</a>
</td>
<td class=\"image_links_abstand\">
</td>"
;
if ($nummer != 0) {
print
"<td>
<a href=\"$srv_dir/image.php?index=$index&nummer=";
print $nummer-1;
print "&height=$height&stylesheet=$stylesheet\">Previous</a>
</td>
<td class=\"image_links_abstand\">
</td>"
;
}
if ($nummer != sizeof($images)-1) {
print
"<td>
<a href=\"$srv_dir/image.php?index=$index&nummer=";
print $nummer+1;
print "&height=$height&stylesheet=$stylesheet\">Next</a>
</td>
<td class=\"image_links_abstand\">
</td>"
;
}
print
"</tr>
</table>
<table class=\"zentriert\">
<tr>
<td>
<img src=\"$pic_dir/images/$image\" alt=\"$image\" height=\"$height\" class=\"ima
ge\">
</td>
</tr>
</table>
</body>
</html>"
;
?>
/*
This file is part of Pic Gallery
Copyright (C) 2003/2004 Soenke Gluch
Pic Gallery is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Pic Gallery is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Pic Gallery; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
td {
text-align:center;
}
td.image_links_abstand {
width:20px;
}
.tn {
border:0px solid #000000;
border:1px solid #2F4F4F;
}
a.tn:link {
border:0px solid #000000;
}
a.tn:visited {
border:0px solid #000000;
}
a.tn:hover {
border:0px solid #000000;
text-decoration:none;
}
a.tn:active {
border:0px solid #000000;
}
a.tn:focus {
border:0px solid #000000;
}
.fullwidth {
width:100%;
}
table.zentriert {
text-align:center;
margin-left:auto;
margin-right:auto;
}
.zentriert {
text-align:center;
}
img.image {
border:1px solid #2F4F4F;
}
<?PHP
// This file is part of Pic Gallery
// Copyright (C) 2003/2004 Soenke Gluch
// Pic Gallery is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// Pic Gallery is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Pic Gallery; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$titel = "Sample Gallery";
$tn_height = 113;
$height = 650;
$rows = 4;
$stylesheet = "/styles/styles.css";
include "../pics.php";
?>