Ja da... Alle de inkluderede filer er dele af mit design, og andre måder at gøre det nemt for mig selv på. De er ikke vigtige for at systemet virker.
Det kan ses live på
http://www.nikkiwebster.dk/photo_gallery/gallery.php (Med nydelige thumbnails efter opgradering til GD2 og omskrivining af thumbs.php som er posted højere oppe)
Viewere her under arbejder sammen med thumbs.php og undersøger selv om der er en thumb, hvis ikke sættes src på billedet til thumbs.php?filnavn, og hvis der er sættes den til thumbs/filnavn.jpg
Thumbs.php håndtere kun png og jpg, ikke gif, så hvis det er gif skal man bruge imagemagick, eller lave dem manuelt.
Smider også lige den nye version af thumbs.php
--------------------------Gallery.php----------------------------------
<?php
include("../functions.php");
if ($page == "") {
$page = "1";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<link rel=stylesheet type="text/css" href="../layout.css">
<link rel="stylesheet" type="text/css" href="../menu.css">
<TITLE> NikkiWebster.DK -> Photo Gallery Page <?php echo $page; ?> </TITLE>
</HEAD>
<BODY bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF">
<?php include("../menu.php"); ?>
<h1><center><?php makeheadline("Nikki Webster Photo Gallery"); ?></center></h1>
<?php
echo "Page: ".$page."<br>\n";
$dircont = opendir("./pics");
while ($file = readdir($dircont)) {
if (is_file("./pics/$file") && $file != "index.html") {
if ($bitbucket = GetImageSize("./pics/$file")) {
$filenames .= "$file;";
}
else {
echo "Offending file: $file<br>\n";
}
}
}
$filearray = explode(";",$filenames);
natcasesort($filearray);
$imagesshown = 0;
$imagespassed = 1;
$imagesonpage = 20;
$imagesinrow = 5;
$go = "false";
echo "Total Number of Pictures: ".count($filearray)."<br>\n";
if (((($page-1)*$imagesonpage)+$imagesonpage) < count($filearray)) {
$lastimage = ((($page-1)*$imagesonpage)+$imagesonpage);
}
else {
$lastimage = count($filearray);
}
echo "Showing Pictures: ".((($page-1)*$imagesonpage)+1)."-".$lastimage."<br>\n";
echo "<table border=\"3\" style=\"border-color: #FFFFFF;\" align=\"center\"><tr>";
foreach ($filearray as $value) {
if ($page == "1") {
$go = "true";
}
if ($imagespassed == (($page-1)*$imagesonpage)) {
$go = "true";
}
else {
$imagespassed++;
}
if ($go == "true" && trim($value) != "") {
$size = getimagesize("pics/$value");
if (strlen($value) > 11) {
$leng = 0;
$value_short = "";
while ($leng < 11) {
$value_short .= $value[$leng];
$leng++;
}
$value_short .= "...";
}
else {
$value_short = $value;
}
if (file_exists("thumbs/$value")) {
$size = getimagesize("thumbs/$value");
echo "<td valign=\"bottom\" align=\"center\" bgcolor=\"#000000\"><a href=\"showpic.php?image=".rawurlencode($value)."\"><img src=\"thumbs/".rawurlencode($value)."\" {$size[3]} alt=\"$value_short\" border=\"0\"><br>$value_short</td>";
}
else {
echo "<td valign=\"bottom\" border=\"0\" align=\"center\" bgcolor=\"#000000\"><a href=\"showpic.php?image=".rawurlencode($value)."\"><img src=\"thumb.php?".urlencode($value)."\" alt=\"$value_short\" border=\"0\"><br>$value_short</td>";
}
$imagesshown++;
}
if ($imagesshown/$imagesinrow == round($imagesshown/$imagesinrow) && file_exists("pics/$value") && $go == "true") {
echo "</tr>\n<tr>";
}
if ($imagesshown == $imagesonpage) {
break;
}
}
echo "</tr></table>\n";
$pages = 0;
while ($pages < ceil((count($filearray)-1)/$imagesonpage)) {
if ($pages+1 == $page) {
$pagelist .= "<b>".($pages+1)."</b> | ";
}
else {
$pagelist .= "<a href=\"$PHP_SELF?page=".($pages+1)."\">".($pages+1)."</a> | ";
}
$pages++;
}
echo "<br><center>Page: ".substr($pagelist,0,-3)."</center>\n";
include("../counter/counter.php");
?>
</BODY>
</HTML>
----------------------------Gallery.php---------------------------------
-----------------------------Thumbs.php---------------------------------
<?php
foreach ($argv as $val) {
$imagefile .= $val." ";
}
$imagefile = trim($imagefile);
$imageinfo = getimagesize("pics/$imagefile");
if ($imageinfo[2] == 2) {
header("Content-Type: image/jpeg");
$makemesmall = imagecreatefromjpeg("pics/$imagefile");
if (ImageSX($makemesmall) > ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(100,75);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,101,76,ImageSX($makemesmall),ImageSY($makemesmall));
}
elseif (ImageSX($makemesmall) < ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(75,100);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,76,101,ImageSX($makemesmall),ImageSY($makemesmall));
}
elseif (ImageSX($makemesmall) == ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(100,100);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,101,101,ImageSX($makemesmall),ImageSY($makemesmall));
}
imagejpeg($thumbed,"./thumbs/$imagefile");
$file = fopen("./thumbs/$imagefile","r");
fpassthru($file);
}
elseif ($imageinfo[3] == 3) {
$im = imagecreatefrompng("pics/$imagefile");
header("Content-Type: image/png");
$makemesmall = imagecreatefrompng("pics/$imagefile");
if (ImageSX($makemesmall) > ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(100,75);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,101,76,ImageSX($makemesmall),ImageSY($makemesmall));
}
elseif (ImageSX($makemesmall) < ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(75,100);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,76,101,ImageSX($makemesmall),ImageSY($makemesmall));
}
elseif (ImageSX($makemesmall) == ImageSY($makemesmall)) {
$thumbed = imagecreatetruecolor(100,100);
$white = imagecolorresolve($thumbed,0,0,255);
imagefill($thumbed,0,0,$white);
imagecopyresampled($thumbed,$makemesmall,0,0,0,0,101,101,ImageSX($makemesmall),ImageSY($makemesmall));
}
imagepng($im,"thumbs/$imagefile");
$file = fopen("thumbs/$imagefile","r");
fpassthru($file);
}
?>
-----------------------------Thumbs.php---------------------------------
Men måske du har mere brug for noget som
http://photos.nikkiwebster.dk/ ?