Archived
1
0
Fork 0

implement support for vertical scrolling (fixes #46)

This commit is contained in:
Jan Dittberner 2009-07-11 19:14:36 +00:00
parent c99d72ff55
commit 22ad44f0a8
2 changed files with 25 additions and 20 deletions

View file

@ -6,7 +6,7 @@
* @author Jan Dittberner <jan@dittberner.info> * @author Jan Dittberner <jan@dittberner.info>
* @version \$Id$ * @version \$Id$
* *
* Copyright (c) 2007, 2008 Jan Dittberner <jan@dittberner.info> * Copyright (c) 2007, 2008, 2009 Jan Dittberner <jan@dittberner.info>
* Jan Dittberner IT-Consulting & -Solutions, * Jan Dittberner IT-Consulting & -Solutions,
* Cottbuser Str. 1, D-01129 Dresden * Cottbuser Str. 1, D-01129 Dresden
* *
@ -54,16 +54,6 @@ if (array_key_exists('theme', $_GET) &&
$theme = new Theme($configuration['defaulttheme']); $theme = new Theme($configuration['defaulttheme']);
} }
/**
* Breite der Vorschaubilder.
*/
$previewwidth = $theme->previewsize;
/**
* Höhe der Thumbnailbilder.
*/
$thumbheight = $theme->thumbsize;
/** /**
* Prüft, ob eine Galerie mit dem übergebenen Namen existiert. * Prüft, ob eine Galerie mit dem übergebenen Namen existiert.
* *
@ -117,13 +107,15 @@ function getGalleryConfig($galleryname = null) {
* @li @a full relative URL des Vollbildes * @li @a full relative URL des Vollbildes
*/ */
function getImageInfo($galleryname, $imagename) { function getImageInfo($galleryname, $imagename) {
global $theme;
$label = getImageLabel($galleryname, $imagename); $label = getImageLabel($galleryname, $imagename);
$gallerylabel = getGalleryLabel($galleryname); $gallerylabel = getGalleryLabel($galleryname);
return array("name" => $imagename, return array("name" => $imagename,
"label" => $label, "label" => $label,
"preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR . "preview" => GALLERYPREFIX . DIRECTORY_SEPARATOR .
getScaledImage($galleryname, $imagename, getScaledImage($galleryname, $imagename,
$GLOBALS["previewwidth"], false), $theme->previewsize, false),
"full" => GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname . "full" => GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname .
DIRECTORY_SEPARATOR . $imagename, DIRECTORY_SEPARATOR . $imagename,
"title" => sprintf("%s :: %s", $gallerylabel, $label) "title" => sprintf("%s :: %s", $gallerylabel, $label)
@ -286,22 +278,33 @@ function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) {
* und dem Ergebnis von getimagesize() als Werten ist. * und dem Ergebnis von getimagesize() als Werten ist.
*/ */
function getThumbNailInfo($galleryname) { function getThumbNailInfo($galleryname) {
global $theme;
$thumbsizes = array(); $thumbsizes = array();
$thumbwidthsum = 2; $thumbdimsum = 2;
foreach (glob(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR . foreach (glob(realpath(GALLERYPREFIX . DIRECTORY_SEPARATOR .
$galleryname) . DIRECTORY_SEPARATOR . $galleryname) . DIRECTORY_SEPARATOR .
'*.jp{e,}g', GLOB_BRACE) as $filename) { '*.jp{e,}g', GLOB_BRACE) as $filename) {
$basename = basename($filename); $basename = basename($filename);
$thumbfile = getScaledImage($galleryname, $basename, if ($theme->themetype == 'horizontal') {
$GLOBALS["thumbheight"]); $thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize,
true);
} else {
$thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize,
false);
}
if ($thumbsize = getimagesize(realpath(GALLERYPREFIX . if ($thumbsize = getimagesize(realpath(GALLERYPREFIX .
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR .
$thumbfile))) { $thumbfile))) {
$thumbsizes[$basename] = array($thumbfile, $thumbsize); $thumbsizes[$basename] = array($thumbfile, $thumbsize);
$thumbwidthsum = $thumbwidthsum + $thumbsize[0] + 3; if ($theme->themetype == 'horizontal') {
$thumbdimsum = $thumbdimsum + $thumbsize[0] + 3;
} else {
$thumbdimsum = $thumbdimsum + $thumbsize[1] + 3;
} }
} }
return array($thumbwidthsum, $galleryname, $thumbsizes); }
return array($thumbdimsum, $galleryname, $thumbsizes);
} }
/** /**
@ -370,6 +373,8 @@ function getAllThumbnails(&$thumbinfo) {
* @see getThumbNailInfo() * @see getThumbNailInfo()
*/ */
function getFirstPreview(&$thumbinfo) { function getFirstPreview(&$thumbinfo) {
global $theme;
reset($thumbinfo[2]); reset($thumbinfo[2]);
$basename = key($thumbinfo[2]); $basename = key($thumbinfo[2]);
$data = current($thumbinfo[2]); $data = current($thumbinfo[2]);
@ -377,7 +382,7 @@ function getFirstPreview(&$thumbinfo) {
$fullname = GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname . $fullname = GALLERYPREFIX . DIRECTORY_SEPARATOR . $galleryname .
DIRECTORY_SEPARATOR . $basename; DIRECTORY_SEPARATOR . $basename;
$scaledimage = getScaledImage($galleryname, $basename, $scaledimage = getScaledImage($galleryname, $basename,
$GLOBALS["previewwidth"], false); $theme->previewsize, false);
$scaledimagesize = getimagesize(realpath(GALLERYPREFIX . $scaledimagesize = getimagesize(realpath(GALLERYPREFIX .
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR .
$scaledimage)); $scaledimage));

View file

@ -74,7 +74,7 @@ $(document).ready(function() {
$("#scrollable").stop(); $("#scrollable").stop();
}); });
$("#arrright").mouseover(function() { $("#arrright").mouseover(function() {
offset = parseInt($("#imgscroller").css("width")) - var offset = parseInt($("#imgscroller").css("width")) -
parseInt($("#scrollable").css("width")); parseInt($("#scrollable").css("width"));
$("#scrollable").animate({ $("#scrollable").animate({
left: offset + "px" left: offset + "px"
@ -91,7 +91,7 @@ $(document).ready(function() {
$('#scrollable').stop(); $('#scrollable').stop();
}); });
$('#arrdown').mouseover(function() { $('#arrdown').mouseover(function() {
offset = parseInt($('#imgscroller').css('height')) - var offset = parseInt($('#imgscroller').css('height')) -
parseInt($('#scrollable').css('height')); parseInt($('#scrollable').css('height'));
$('#scrollable').animate({ $('#scrollable').animate({
top: offset + "px" top: offset + "px"