Erstes großes Refactoring
* alle gemeinsamen Funktionen in includes/galleryfunctions.php zusammengeführt (fixes #21) * AJAX-Requests werden in ajaxrequest.php behandelt und liefern zusätzlich zum Titel auch die URLs des Vorschau- und des Vollbildes (fixes #22), die übergebenen Request-Parameter werden syntaktisch geprüft (fixes #23) * Die Vorschau- und Thumbnail-Bilder werden in der Funktion getScaledImage() in includes/galleryfunctions.php generiert und im Filesystem abgelegt (fixes #10) * Bildbeschreibungen sind jetzt in einem .ini-Format in bilder/example/galleryinfo.ini in der Sektion "images" definiert (addresses #20) * Rendern der Menüpunkte in index.php und includes/galleryfunctions.php vorbereitet (addresses #16) * Die AJAX-Aufrufe und Pfadberechnungen in scripts/ourhandlers.js wurden korrigiert und an die neue AJAX-Handler-URL angepasst (addresses #22, fixes #19) * Beispielbilder in Unterverzeichnis ''bilder/example'' verschoben und die Möglichkeit vorgesehen in ''bilder/galleryinfo.ini'' eine Standardgallerie anzugeben (fixes #24, addresses #20, #16)
|
@ -1,13 +1,11 @@
|
|||
<?php
|
||||
/*
|
||||
* Code for displaying image descriptions.
|
||||
/**
|
||||
* Diese Datei behandelt AJAX-Requests.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Jan Dittberner IT-Consulting & -Solutions,
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* Copyright (c) 2008 Jeremias Arnstadt <douth024@googlemail.com>
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
|
@ -27,10 +25,19 @@
|
|||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
include_once("fetchdescription.php");
|
||||
$imginfo = getImgInfo($allfiles[0]);
|
||||
if (is_array($imginfo) && isset($imginfo["data"])) {
|
||||
print htmlentities($imginfo["data"]);
|
||||
include("includes/galleryfunctions.php");
|
||||
|
||||
if (isset($_GET["imagename"]) && isset($_GET["galleryname"]) &&
|
||||
preg_match('/^[\w\d _-]+\.jp(e|)g$/', $_GET["imagename"]) &&
|
||||
preg_match(GALLERY_RE, $_GET["galleryname"])) {
|
||||
header("Content-Type: text/plain; charset=UTF-8");
|
||||
if ($imageInfo = getImgInfo($_GET["galleryname"], $_GET["imagename"])) {
|
||||
print json_encode($imageInfo);
|
||||
} else {
|
||||
print $imginfo;
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
header("Status: 404 Not Found");
|
||||
}
|
||||
} else {
|
||||
header("HTTP/1.0 400 Bad Request");
|
||||
header("Status: 400 Bad Request");
|
||||
}
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
7
bilder/example/galleryinfo.ini
Normal file
|
@ -0,0 +1,7 @@
|
|||
[images]
|
||||
cimg3033_Small.jpg = Kerze
|
||||
cimg3071_Small.jpg = Gerät
|
||||
cimg3157_Small.jpg = Abstract
|
||||
cimg4188_Small.jpg = Blume
|
||||
cimg4191_Small.jpg = Blume - Rose
|
||||
cimg5178_Small.jpg = Gerät nah
|
|
@ -1,6 +0,0 @@
|
|||
cimg3033_Small.jpg Kerze
|
||||
cimg3071_Small.jpg Gerät
|
||||
cimg3157_Small.jpg Abstract
|
||||
cimg4188_Small.jpg Blume
|
||||
cimg4191_Small.jpg Blume - Rose
|
||||
cimg5178_Small.jpg Gerät nah
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Holt die Bildinformationen zu einem Bild aus der Datei
|
||||
* bilder/imginfo.txt und gibt diese zurueck.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions,
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
$infofile = "bilder/imginfo.txt";
|
||||
$prefix = "bilder/";
|
||||
|
||||
function getImgInfo($imagename) {
|
||||
if (file_exists($imagename)) {
|
||||
$imagename = substr($imagename, strlen($GLOBALS["prefix"]));
|
||||
}
|
||||
if (file_exists($GLOBALS["prefix"] . $imagename)) {
|
||||
foreach (file($GLOBALS["infofile"]) as $line) {
|
||||
$firstspace = strpos($line, " ");
|
||||
$name = substr($line, 0, $firstspace);
|
||||
$data = trim(substr($line, $firstspace + 1));
|
||||
if (strcmp($name, $imagename) == 0) {
|
||||
$retval = array("name" => $name,
|
||||
"data" => trim($data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return $GLOBALS["prefix"] . $imagename . " doesn't exist";
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
if (isset($_GET["imagename"])) {
|
||||
header("Content-Type: text/plain; charset=UTF-8");
|
||||
print json_encode(getImgInfo($_GET["imagename"]));
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Code for displaying the detail images.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* Copyright (c) 2008 Jeremias Arnstadt <douth024@googlemail.com>
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
$width_middle = 311;
|
||||
printf("<a href=\"%s\" class=\"lightbox\" ><img id=\"contentimg\" src=\"%s\" alt=\"\" width=\"%s\" /></a>",
|
||||
dirname($allfiles[0]) . DIRECTORY_SEPARATOR . basename($allfiles[0]),
|
||||
$allfiles[0], $width_middle);
|
|
@ -1,41 +0,0 @@
|
|||
<?
|
||||
/*
|
||||
* Code for calculating thumbnail image sizes.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
$thumbsizes = array();
|
||||
$thumbwidthsum = 2;
|
||||
$thumbheight = 67;
|
||||
foreach ($allfiles as $filename) {
|
||||
$directory = dirname($filename);
|
||||
$basename = basename($filename);
|
||||
$thumbfile = $directory .
|
||||
DIRECTORY_SEPARATOR . $basename;
|
||||
if ($thumbsize = getimagesize($thumbfile)) {
|
||||
$thumbsizes[$thumbfile] = $thumbsize;
|
||||
$thumbwidthsum = $thumbwidthsum + $thumbsize[0] + 3;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Code for showing thumbnail images.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
foreach ($thumbsizes as $thumbfile => $thumbsize) {
|
||||
printf("<div class=\"thumbnail\"><img src=\"%s\" alt=\"\" height=\"%s\" /></div>",
|
||||
$thumbfile, $thumbheight);
|
||||
}
|
224
includes/galleryfunctions.php
Normal file
|
@ -0,0 +1,224 @@
|
|||
<?php
|
||||
/**
|
||||
* Diese Datei stellt die verschiedenen Funktionen für den Aufbau der
|
||||
* Bildergallerie zur Verfügung.
|
||||
*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions,
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
define(GALLERYPREFIX, "bilder");
|
||||
define(INFOFILE, "galleryinfo.ini");
|
||||
define(IMAGESEC, "images");
|
||||
define(GALLERYSEC, "gallery");
|
||||
define(GALLERY_RE, '/^[\w\d _-]+$/');
|
||||
|
||||
$previewwidth = 311;
|
||||
$thumbheight = 67;
|
||||
|
||||
function galleryExists($galleryname) {
|
||||
return preg_match(GALLERY_RE, $galleryname) &&
|
||||
realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname);
|
||||
}
|
||||
|
||||
function getGalleryConfig($galleryname = null) {
|
||||
if ($galleryname) {
|
||||
$filepath = realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR .
|
||||
$galleryname . DIRECTORY_SEPARATOR . INFOFILE);
|
||||
} else {
|
||||
$filepath = realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . INFOFILE);
|
||||
}
|
||||
if (is_file($filepath)) {
|
||||
return parse_ini_file($filepath, true);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt die Bildinformationen zu einem Bild aus der Datei
|
||||
* bilder/imginfo.txt und gibt diese zurueck.
|
||||
*
|
||||
* @param $imagename Bildname
|
||||
* @param $galleryname Galleriename
|
||||
*/
|
||||
function getImgInfo($galleryname, $imagename) {
|
||||
return array("name" => $imagename,
|
||||
"data" => getImageLabel($galleryname, $imagename),
|
||||
"preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR .
|
||||
getScaledImage($galleryname, $imagename,
|
||||
$GLOBALS["previewwidth"], false),
|
||||
"full" => GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname .
|
||||
DIRECTORY_SEPARATOR . $imagename
|
||||
);
|
||||
}
|
||||
|
||||
function getImageLabel($galleryname, $imagename) {
|
||||
$gallerypath = realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname);
|
||||
if (empty($gallerypath) || !is_dir($gallerypath)) {
|
||||
return false;
|
||||
}
|
||||
$filepath = $gallerypath . DIRECTORY_SEPARATOR . $imagename;
|
||||
if (!is_file($filepath)) {
|
||||
return false;
|
||||
}
|
||||
$inidata = getGalleryConfig($galleryname);
|
||||
$value = $inidata[IMAGESEC][$imagename];
|
||||
if ($value) {
|
||||
return $value;
|
||||
}
|
||||
return $imagename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die aktuelle Gallerie. Die Gallerie kann entweder im
|
||||
* GET-Parameter "galleryname" stehen, in der "gallery"-Sektion der
|
||||
* zentralen galleryinfo.ini angegeben werden oder es wird das erste
|
||||
* Unterverzeichnis von GALLERYPREFIX verwendet.
|
||||
*/
|
||||
function getCurrentGallery() {
|
||||
if (galleryExists($_GET["galleryname"])) {
|
||||
return $_GET["galleryname"];
|
||||
}
|
||||
$filepath = realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . INFOFILE);
|
||||
if (!empty($filepath)) {
|
||||
$inidata = getGalleryConfig();
|
||||
if (galleryExists($inidata[GALLERYSEC]["default"])) {
|
||||
return $inidata[GALLERYSEC]["default"];
|
||||
}
|
||||
}
|
||||
foreach (glob(realpath(GALLERYPREFIX) . DIRECTORY_SEPARATOR . '*',
|
||||
GLOB_ONLYDIR) as $directory) {
|
||||
$basename = basename($directory);
|
||||
if (galleryExists($basename)) {
|
||||
return $basename;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) {
|
||||
if ($maxdim == 0) {
|
||||
debug_print_backtrace();
|
||||
}
|
||||
$gallerydir = realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname);
|
||||
if ($scaleheight) {
|
||||
$scaleddir = sprintf("%s%sscaled_x%d", $galleryname,
|
||||
DIRECTORY_SEPARATOR, $maxdim);
|
||||
} else {
|
||||
$scaleddir = sprintf("%s%sscaled%dx_", $galleryname,
|
||||
DIRECTORY_SEPARATOR, $maxdim);
|
||||
}
|
||||
$scaleddirpath = GALLERYPREFIX . DIRECTORY_SEPARATOR . $scaleddir;
|
||||
if (!is_dir($scaleddirpath)) {
|
||||
// versuchen das Thumbnail-Verzeichnis anzulegen
|
||||
$mkdir = @mkdir($scaleddirpath, 0755);
|
||||
if (!$mkdir) {
|
||||
return $galleryname . DIRECTORY_SEPARATOR . $basename;
|
||||
}
|
||||
}
|
||||
|
||||
$scaledimage = $scaleddirpath . DIRECTORY_SEPARATOR . $basename;
|
||||
if (!is_file($scaledimage)) {
|
||||
// Datei erzeugen
|
||||
$originalfile = $gallerydir . DIRECTORY_SEPARATOR . $basename;
|
||||
$origimage = imagecreatefromjpeg($originalfile);
|
||||
$origx = imagesx($origimage);
|
||||
$origy = imagesy($origimage);
|
||||
if ($scaleheight) {
|
||||
$scaleratio = $origy / (1.0 * $maxdim);
|
||||
$newy = $maxdim;
|
||||
$newx = (int) $origx / $scaleratio;
|
||||
} else {
|
||||
$scaleratio = $origx / (1.0 * $maxdim);
|
||||
$newx = $maxdim;
|
||||
$newy = (int) $origy / $scaleratio;
|
||||
}
|
||||
$newimage = imagecreatetruecolor($newx, $newy);
|
||||
imagecopyresampled($newimage, $origimage, 0, 0, 0, 0, $newx, $newy,
|
||||
$origx, $origy);
|
||||
imagejpeg($newimage, $scaledimage, 90);
|
||||
}
|
||||
return $scaleddir . DIRECTORY_SEPARATOR . $basename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Informationen über Vorschaubilder zurück.
|
||||
*
|
||||
* @return array das erste Element ist die aufsummierte Breite der
|
||||
* Einzelbilder und das zweite Element ist ein assoziatives Array mit
|
||||
* den Bildnamen als Keys und dem Ergebnis von getimagesize() als
|
||||
* Werten
|
||||
*/
|
||||
function getThumbNailInfo($galleryname) {
|
||||
$thumbsizes = array();
|
||||
$thumbwidthsum = 2;
|
||||
foreach (glob(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR .
|
||||
$galleryname) . DIRECTORY_SEPARATOR .
|
||||
'*.jp{e,}g', GLOB_BRACE) as $filename) {
|
||||
$basename = basename($filename);
|
||||
$thumbfile = getScaledImage($galleryname, $basename,
|
||||
$GLOBALS["thumbheight"]);
|
||||
if ($thumbsize = getimagesize(realpath(GALLERYPREFIX .
|
||||
DIRECTORY_SEPARATOR .
|
||||
$thumbfile))) {
|
||||
$thumbsizes[$basename] = array($thumbfile, $thumbsize);
|
||||
$thumbwidthsum = $thumbwidthsum + $thumbsize[0] + 3;
|
||||
}
|
||||
}
|
||||
return array($thumbwidthsum, $galleryname, $thumbsizes);
|
||||
}
|
||||
|
||||
function getGalleryLinks() {
|
||||
}
|
||||
|
||||
function showThumbnails(&$thumbinfo) {
|
||||
foreach ($thumbinfo[2] as $basename => $data) {
|
||||
printf("<div class=\"thumbnail\"><img src=\"%s\" alt=\"\" \"%s\" /></div>",
|
||||
GALLERYPREFIX . DIRECTORY_SEPARATOR . $data[0],
|
||||
$data[1][3]);;
|
||||
}
|
||||
}
|
||||
|
||||
function showPreview(&$thumbinfo) {
|
||||
foreach ($thumbinfo[2] as $basename => $data) {
|
||||
$galleryname = $thumbinfo[1];
|
||||
$fullname = GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname .
|
||||
DIRECTORY_SEPARATOR . $basename;
|
||||
$scaledimage = getScaledImage($galleryname, $basename,
|
||||
$GLOBALS["previewwidth"], false);
|
||||
$scaledimagesize = getimagesize(realpath(GALLERYPREFIX .
|
||||
DIRECTORY_SEPARATOR .
|
||||
$scaledimage));
|
||||
printf("<a href=\"%s\" class=\"lightbox\" ><img id=\"contentimg\" src=\"%s%s%s\" alt=\"%s\" %s /></a>",
|
||||
$fullname, GALLERYPREFIX, DIRECTORY_SEPARATOR, $scaledimage,
|
||||
getImageLabel($galleryname, $basename), $scaledimagesize[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function renderDescription(&$thumbinfo) {
|
||||
foreach ($thumbinfo[2] as $basename => $data) {
|
||||
print htmlentities(getImageLabel($thumbinfo[1], $basename));
|
||||
break;
|
||||
}
|
||||
}
|
22
index.php
|
@ -25,14 +25,16 @@
|
|||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
// Pfad der Bilder für die jeweilige Kategorie
|
||||
$allfiles = glob("./bilder/*.jpg");
|
||||
|
||||
// Name des Menüpunktes
|
||||
$menupunkt = "Beispielbilder 1";
|
||||
|
||||
// greift auf die Funktionen der ausgelagerten Datei um die Thumbnails
|
||||
// einzulesen
|
||||
include ("./funktionen/thumbnail.php");
|
||||
include ("includes/galleryfunctions.php");
|
||||
|
||||
$gallery = getCurrentGallery();
|
||||
$thumbinfo = getThumbNailInfo($gallery);
|
||||
|
||||
// bezieht sich auf die Hauptmenükategorie (für Anzeige von aktivem
|
||||
// Link notwendig)
|
||||
|
@ -58,7 +60,7 @@ $aquarelle = ($menu = 14);
|
|||
<script src="./scripts/ourhandlers.js" type="text/javascript" ></script>
|
||||
<style type="text/css">
|
||||
<?php
|
||||
printf("#scrollable { width:%dpx; }", $thumbwidthsum);
|
||||
printf("#scrollable { width:%dpx; }", $thumbinfo[0]);
|
||||
?>
|
||||
a {
|
||||
font-size: 9px;
|
||||
|
@ -81,26 +83,22 @@ a:active {
|
|||
<!-- container -->
|
||||
<div id="container">
|
||||
<div id="content">
|
||||
<div id="menu"><? include ("menu/menu.php"); ?></div>
|
||||
<div id="menu"><? getGalleryLinks(); ?></div>
|
||||
<div id="content_container">
|
||||
<div id="slider">
|
||||
<div id="arrleft"><img src="css/grafiken/aro-lft.png" alt="nach links" width="10" height="65" /></div>
|
||||
<div id="imgscroller"><div id="scrollable"><?php
|
||||
// zeigt die eingelesenen Thumnails an
|
||||
include("./funktionen/thumbnail_show.php");
|
||||
showThumbNails($thumbinfo);
|
||||
?></div></div>
|
||||
<div id="arrright"><img src="css/grafiken/aro-rt.png" alt="nach rechts" width="10" height="65" /></div>
|
||||
</div>
|
||||
<div id="sub_menu"><?php
|
||||
// bindet das Submenü mit definiertem Links ein.
|
||||
include("submenu.php");
|
||||
?></div>
|
||||
</div>
|
||||
<div id="content_sub">
|
||||
<div id="content_main">
|
||||
<div class="bildposition"><?php
|
||||
// bindet die Bilder in den Hauptbereich ein
|
||||
include ("./funktionen/show_pictures.php");
|
||||
showPreview($thumbinfo);
|
||||
?></div>
|
||||
</div>
|
||||
<div id="content_nav">
|
||||
|
@ -108,7 +106,7 @@ a:active {
|
|||
</div>
|
||||
<div class="imgdescription" id="imagedescription"><?php
|
||||
// liest die Bildbeschreibung für das jeweilige Bild (wenn definiert)
|
||||
include ("funktionen/description.php");
|
||||
renderDescription($thumbinfo);
|
||||
?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* Copyright (c) 2008 Jeremias Arnstadt <douth024@googlemail.com>
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
/*
|
||||
$verzeichnis = realpath($_SERVER['DOCUMENT_ROOT'] . "/bild_framework/");
|
||||
echo "<ol>";
|
||||
|
||||
if ( is_dir ($verzeichnis ))
|
||||
{
|
||||
if ( $handle = opendir ($verzeichnis))
|
||||
{ while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
echo "<li>Dateiname:";
|
||||
echo $file;
|
||||
|
||||
echo "<ul><li>Dateityp: ";
|
||||
echo filetype ( $file );
|
||||
echo "</li></ul>\n";
|
||||
}
|
||||
closedor($handle);
|
||||
}
|
||||
}
|
||||
echo "</ol>";
|
||||
*/
|
|
@ -24,40 +24,41 @@
|
|||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
var imgprefix = "";
|
||||
var imgfull = "";
|
||||
var imgthumb = "";
|
||||
var imgprefix = "bilder";
|
||||
|
||||
function getPathParts(imagesrc) {
|
||||
var filename = imagesrc.substring(imagesrc.lastIndexOf("/") + 1);
|
||||
var pathstart =imagesrc.substring(0, imagesrc.lastIndexOf("/") + 1);
|
||||
if (pathstart.indexOf(imgfull) ==
|
||||
(pathstart.length - imgfull.length)) {
|
||||
pathstart = pathstart.substring(0, pathstart.length - imgfull.length);
|
||||
} else if (pathstart.indexOf(imgthumb) ==
|
||||
(pathstart.length - imgthumb.length)) {
|
||||
pathstart = pathstart.substring(0, pathstart.length - imgthumb.length);
|
||||
var pathstart = imagesrc.substring(0, imagesrc.lastIndexOf("/"));
|
||||
// run through directories until imgprefix is found
|
||||
var dirstack = new Array();
|
||||
var current = pathstart.substring(pathstart.lastIndexOf("/") + 1);
|
||||
while (current != imgprefix) {
|
||||
dirstack.push(current);
|
||||
pathstart = pathstart.substring(0, pathstart.lastIndexOf("/"));
|
||||
current = pathstart.substring(pathstart.lastIndexOf("/") + 1);
|
||||
}
|
||||
var dirname = pathstart.split(imgprefix)[1];
|
||||
var basename = dirname + filename
|
||||
var retval = {
|
||||
var galleryname = dirstack.pop();
|
||||
var dirname = null;
|
||||
if (dirstack.length > 0) {
|
||||
dirname = dirstack.pop();
|
||||
}
|
||||
return {
|
||||
'filename' : filename,
|
||||
'pathstart' : pathstart,
|
||||
'dirname' : dirname,
|
||||
'basename' : basename
|
||||
'gallery' : galleryname,
|
||||
'pathstart' : pathstart
|
||||
};
|
||||
return retval;
|
||||
}
|
||||
|
||||
function updateContentImage(pathParts) {
|
||||
var content_main = $("#content_main img").attr("src",
|
||||
pathParts.pathstart + pathParts.filename);
|
||||
$("#content_main a").attr("href", pathParts.pathstart +
|
||||
imgfull + pathParts.filename);
|
||||
$.getJSON("fetchdescription.php",
|
||||
{"imagename" : pathParts.basename},
|
||||
function(data, textStatus) {
|
||||
$.getJSON("ajaxrequest.php", {
|
||||
"imagename" : pathParts.filename,
|
||||
"galleryname" : pathParts.gallery
|
||||
}, function(data, textStatus) {
|
||||
$("#imagedescription").text(data["data"]);
|
||||
$("#content_main img").attr("alt", data["data"]);
|
||||
$("#content_main img").attr("src", data["preview"]);
|
||||
$("#content_main a").attr("href", data["full"]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -65,7 +66,7 @@ $(document).ready(function() {
|
|||
$("#arrleft").mouseover(function() {
|
||||
$("#scrollable").animate({
|
||||
left: "0px"
|
||||
}, 5000);
|
||||
}, 500);
|
||||
}).mouseout(function() {
|
||||
$("#scrollable").stop();
|
||||
});
|
||||
|
@ -74,35 +75,47 @@ $(document).ready(function() {
|
|||
parseInt($("#scrollable").css("width"));
|
||||
$("#scrollable").animate({
|
||||
left: offset + "px"
|
||||
}, 18000);
|
||||
}, 500);
|
||||
}).mouseout(function() {
|
||||
$("#scrollable").stop();
|
||||
});
|
||||
$("#backbtn").click(function() {
|
||||
var parts = getPathParts($("img#contentimg").attr("src"));
|
||||
var pred = null;
|
||||
$("div.thumbnail img").each(function() {
|
||||
if (pred == null) {
|
||||
pred = getPathParts(this.src);
|
||||
$("div.thumbnail img").each(function(i) {
|
||||
var curparts = getPathParts($("img#contentimg").attr("src"));
|
||||
var myparts = getPathParts($(this).attr("src"));
|
||||
if ((curparts.gallery == myparts.gallery) &&
|
||||
(curparts.filename == myparts.filename)) {
|
||||
var matched = $("div.thumbnail img");
|
||||
var prevparts;
|
||||
if (i > 0) {
|
||||
prevparts = getPathParts(
|
||||
$(matched.get(i-1)).attr("src"));
|
||||
} else {
|
||||
var thumbparts = getPathParts(this.src);
|
||||
if (thumbparts.basename == parts.basename) {
|
||||
updateContentImage(pred);
|
||||
prevparts = getPathParts(
|
||||
$(matched.get(matched.length-1)).attr("src"));
|
||||
}
|
||||
pred = thumbparts;
|
||||
updateContentImage(prevparts);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#fwdbtn").click(function() {
|
||||
var parts = getPathParts($("img#contentimg").attr("src"));
|
||||
var pred = null;
|
||||
$("div.thumbnail img").each(function() {
|
||||
var thumbparts = getPathParts(this.src);
|
||||
if (thumbparts.basename == parts.basename) {
|
||||
pred = thumbparts;
|
||||
} else if (pred != null) {
|
||||
updateContentImage(thumbparts);
|
||||
pred = null;
|
||||
$("div.thumbnail img").each(function(i) {
|
||||
var curparts = getPathParts($("img#contentimg").attr("src"));
|
||||
var myparts = getPathParts($(this).attr("src"));
|
||||
if ((curparts.gallery == myparts.gallery) &&
|
||||
(curparts.filename == myparts.filename)) {
|
||||
var matched = $("div.thumbnail img");
|
||||
var nextparts;
|
||||
if (i < matched.length-1) {
|
||||
nextparts = getPathParts(
|
||||
$(matched.get(i+1)).attr("src"));
|
||||
} else {
|
||||
nextparts = getPathParts(
|
||||
$(matched.get(0)).attr("src"));
|
||||
}
|
||||
updateContentImage(nextparts);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
27
submenu.php
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) 2008 Jan Dittberner <jan@dittberner.info>
|
||||
* Jan Dittberner IT-Consulting & -Solutions
|
||||
* Cottbuser Str. 1, D-01129 Dresden
|
||||
*
|
||||
* Copyright (c) 2008 Jeremias Arnstadt <douth024@googlemail.com>
|
||||
*
|
||||
* This file is part of the ScrollingJQueryGallery component of the
|
||||
* gnuviech-server.de Websitetools
|
||||
*
|
||||
* ScrollingJQueryGallery 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 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* ScrollingJQueryGallery 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 ScrollingJQueryGallery. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|